Skip to content
This repository was archived by the owner on Apr 28, 2023. It is now read-only.

Commit 2fbd969

Browse files
committed
fix: use Cypress.dom.isJquery, close #8
1 parent fe03042 commit 2fbd969

File tree

3 files changed

+4
-9
lines changed

3 files changed

+4
-9
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
node_modules/
22
.DS_Store
33
npm-debug.log
4+
cypress/videos/

src/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ const is = require('check-more-types')
88
const compare = require('snap-shot-compare')
99

1010
const {
11-
isJqueryElement,
1211
serializeDomElement,
1312
serializeReactToHTML,
1413
identity,
@@ -93,7 +92,7 @@ function registerCypressSnapshot () {
9392
const devToolsLog = {
9493
value
9594
}
96-
if (isJqueryElement($el)) {
95+
if (Cypress.dom.isJquery($el)) {
9796
// only add DOM elements, otherwise "expected" value is enough
9897
devToolsLog.$el = $el
9998
}
@@ -134,7 +133,7 @@ function registerCypressSnapshot () {
134133
}
135134

136135
const pickSerializer = (asJson, value) => {
137-
if (isJqueryElement(value)) {
136+
if (Cypress.dom.isJquery(value)) {
138137
return asJson ? serializeDomElement : serializeReactToHTML
139138
}
140139
return identity

src/utils.js

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,6 @@
11
const sd = require('@wildpeaks/snapshot-dom')
22
const beautify = require('js-beautify').html
33

4-
function isJqueryElement (x) {
5-
return x && typeof x === 'object' && 'wrap' in x
6-
}
7-
84
// converts DOM element to a JSON object
95
function serializeDomElement ($el) {
106
// console.log('snapshot value!', $el)
@@ -61,6 +57,5 @@ module.exports = {
6157
serializeDomElement,
6258
serializeReactToHTML,
6359
identity,
64-
countSnapshots,
65-
isJqueryElement
60+
countSnapshots
6661
}

0 commit comments

Comments
 (0)