mirror of
https://github.com/cypress-io/cypress.git
synced 2026-05-01 04:20:23 -05:00
fix: Cypress.dom.isJquery() returns only boolean results (#14325)
This commit is contained in:
@@ -9,5 +9,16 @@ describe('src/dom/jquery', () => {
|
||||
it('is true for actual jquery instances', () => {
|
||||
expect(Cypress.dom.isJquery(Cypress.$(':first'))).to.be.true
|
||||
})
|
||||
|
||||
// https://github.com/cypress-io/cypress/issues/14278
|
||||
it('does not return undefined', () => {
|
||||
cy.visit('fixtures/dom.html')
|
||||
|
||||
cy.get('#dom').then(($el) => {
|
||||
expect(Cypress.dom.isJquery($el[0])).to.eql(false)
|
||||
// @ts-ignore
|
||||
expect(Cypress.dom.isJquery()).to.eql(false)
|
||||
})
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Vendored
+1
-1
@@ -35,7 +35,7 @@ const isJquery = (obj) => {
|
||||
// as the jquery property of the window constructor
|
||||
// for actual jquery, it should be the version number
|
||||
// so we ensure that it is a string (rather than HTML element)
|
||||
return hasJqueryProperty && typeof _.get(obj, 'constructor.prototype.jquery') === 'string'
|
||||
return !!hasJqueryProperty && typeof _.get(obj, 'constructor.prototype.jquery') === 'string'
|
||||
}
|
||||
|
||||
// doing a little jiggle wiggle here
|
||||
|
||||
Reference in New Issue
Block a user