mirror of
https://github.com/datashard/snapshot.git
synced 2024-11-22 06:02:29 +00:00
fix: use Cypress.dom.isJquery, close #8
This commit is contained in:
parent
fe03042087
commit
2fbd969ab8
3 changed files with 4 additions and 9 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
|||
node_modules/
|
||||
.DS_Store
|
||||
npm-debug.log
|
||||
cypress/videos/
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue