fix: use Cypress.dom.isJquery, close #8

This commit is contained in:
Gleb Bahmutov 2017-12-13 16:26:12 -05:00
parent fe03042087
commit 2fbd969ab8
3 changed files with 4 additions and 9 deletions

1
.gitignore vendored
View file

@ -1,3 +1,4 @@
node_modules/
.DS_Store
npm-debug.log
cypress/videos/

View file

@ -8,7 +8,6 @@ const is = require('check-more-types')
const compare = require('snap-shot-compare')
const {
isJqueryElement,
serializeDomElement,
serializeReactToHTML,
identity,
@ -93,7 +92,7 @@ function registerCypressSnapshot () {
const devToolsLog = {
value
}
if (isJqueryElement($el)) {
if (Cypress.dom.isJquery($el)) {
// only add DOM elements, otherwise "expected" value is enough
devToolsLog.$el = $el
}
@ -134,7 +133,7 @@ function registerCypressSnapshot () {
}
const pickSerializer = (asJson, value) => {
if (isJqueryElement(value)) {
if (Cypress.dom.isJquery(value)) {
return asJson ? serializeDomElement : serializeReactToHTML
}
return identity

View file

@ -1,10 +1,6 @@
const sd = require('@wildpeaks/snapshot-dom')
const beautify = require('js-beautify').html
function isJqueryElement (x) {
return x && typeof x === 'object' && 'wrap' in x
}
// converts DOM element to a JSON object
function serializeDomElement ($el) {
// console.log('snapshot value!', $el)
@ -61,6 +57,5 @@ module.exports = {
serializeDomElement,
serializeReactToHTML,
identity,
countSnapshots,
isJqueryElement
countSnapshots
}