-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
dependency: Update jQuery to latest #30345
Changes from all commits
f9f9226
f1b591f
844db79
eb86a7c
34a02db
19bbd98
30ef0de
874be28
91cfc14
c8d1396
17531ad
b5fe393
ddfc43b
5d5a846
ea9d7a2
5b6378b
6614b89
1f0bb68
59caf49
87dac4b
fce86e0
73174df
fc9aef2
eea3036
2f31b3a
57c2304
01faf00
c73de3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,6 +14,7 @@ import Highlight from './selector-playground/Highlight.ce.vue' | |
type $CypressJQuery = any | ||
|
||
const sizzleRe = /sizzle/i | ||
const jQueryRe = /jquery/i | ||
|
||
export class AutIframe { | ||
debouncedToggleSelectorPlayground: DebouncedFunc<(isEnabled: any) => void> | ||
|
@@ -540,8 +541,8 @@ export class AutIframe { | |
$el = $root.find(selector) | ||
} | ||
} catch (err) { | ||
// if not a sizzle error, ignore it and let $el be null | ||
if (!sizzleRe.test(err.stack)) throw err | ||
// if not a sizzle or jQuery error, ignore it and let $el be null | ||
if (!(sizzleRe.test(err.stack) || jQueryRe.test(err.stack))) throw err | ||
Comment on lines
+544
to
+545
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jQuery no longer relies so much on sizzle, so these stack traces changed and are coming from jQuery now. |
||
} | ||
|
||
return $el | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,9 +28,15 @@ describe('src/cy/commands/actions/scroll', () => { | |
this.scrollBoth.scrollTop = 0 | ||
this.scrollBoth.scrollLeft = 0 | ||
|
||
// width/height of scrollable container - width of parent viewport (minux scrollbars) / 2 to get the center | ||
// width or height of DOM in pixels | ||
this.scrollableContainerWidthHeight = 500 | ||
this.elementWidthHeight = 100 | ||
this.scrollBarWidthHeight = 15 | ||
|
||
// divide by 2 to get the center | ||
// browsers round up the pixel value so we need to round it | ||
this.halfScrollPixels = Math.round((500 - 100) / 2) | ||
this.halfScroll = Math.round((this.scrollableContainerWidthHeight - this.elementWidthHeight) / 2) | ||
this.fullScroll = Math.round(this.scrollableContainerWidthHeight - this.elementWidthHeight) | ||
Comment on lines
+31
to
+39
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just cleaning this up to make these arbitrary numbers more understandable. |
||
}) | ||
|
||
describe('subject', () => { | ||
|
@@ -48,7 +54,9 @@ describe('src/cy/commands/actions/scroll', () => { | |
|
||
it('can use window', () => { | ||
cy.window().scrollTo('10px').then((win) => { | ||
expect(win.scrollX).to.eq(10) | ||
// Firefox doesn't round this number like other browsers | ||
// So we round in the test to get consistent results here | ||
expect(Math.round(win.scrollX)).to.eq(10) | ||
}) | ||
}) | ||
|
||
|
@@ -86,11 +94,10 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollHoriz.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-horizontal').scrollTo('50%').then(function () { | ||
// they don't calculate the height of the container | ||
// in the percentage of the scroll (since going the height | ||
// of the container wouldn't scroll at all...) | ||
expect(this.scrollHoriz.get(0).scrollTop).to.eq(0) | ||
expect(this.scrollHoriz.get(0).scrollLeft).to.eq(this.halfScrollPixels) | ||
// since there is no veritical scrollbar to take into account | ||
// this is just half of the basic width | ||
expect(this.scrollHoriz.get(0).scrollLeft).to.eq(this.halfScroll) | ||
}) | ||
}) | ||
}) | ||
|
@@ -112,7 +119,7 @@ describe('src/cy/commands/actions/scroll', () => { | |
|
||
cy.get('#scroll-to-both').scrollTo('top').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(0) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll) | ||
}) | ||
}) | ||
|
||
|
@@ -122,7 +129,7 @@ describe('src/cy/commands/actions/scroll', () => { | |
|
||
cy.get('#scroll-to-both').scrollTo('topRight').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(0) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100)) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.fullScroll) | ||
}) | ||
}) | ||
|
||
|
@@ -131,7 +138,7 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-both').scrollTo('left').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
}) | ||
}) | ||
|
@@ -141,8 +148,8 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-both').scrollTo('center').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll) | ||
}) | ||
}) | ||
|
||
|
@@ -151,8 +158,8 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-both').scrollTo('right').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100)) | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq((this.fullScroll)) | ||
}) | ||
}) | ||
|
||
|
@@ -161,7 +168,7 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-both').scrollTo('bottomLeft').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100)) | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq((this.fullScroll)) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
}) | ||
}) | ||
|
@@ -171,8 +178,8 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-both').scrollTo('bottom').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100)) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq((this.fullScroll)) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll) | ||
}) | ||
}) | ||
|
||
|
@@ -181,8 +188,8 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-both').scrollTo('bottomRight').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq((500 - 100)) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq((500 - 100)) | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq((this.fullScroll)) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq((this.fullScroll)) | ||
}) | ||
}) | ||
}) | ||
|
@@ -233,8 +240,8 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-both').scrollTo('50%', '50%').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll) | ||
}) | ||
}) | ||
|
||
|
@@ -243,7 +250,7 @@ describe('src/cy/commands/actions/scroll', () => { | |
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
|
||
cy.get('#scroll-to-both').scrollTo('0%', '50%').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(this.halfScroll) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(0) | ||
}) | ||
}) | ||
|
@@ -254,7 +261,7 @@ describe('src/cy/commands/actions/scroll', () => { | |
|
||
cy.get('#scroll-to-both').scrollTo('50%', '0%').then(function () { | ||
expect(this.scrollBoth.get(0).scrollTop).to.eq(0) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScrollPixels) | ||
expect(this.scrollBoth.get(0).scrollLeft).to.eq(this.halfScroll) | ||
}) | ||
}) | ||
}) | ||
|
@@ -353,12 +360,8 @@ describe('src/cy/commands/actions/scroll', () => { | |
|
||
// https://github.com/cypress-io/cypress/issues/1924 | ||
it('skips scrollability check', () => { | ||
const scrollTo = cy.spy($.fn, 'scrollTo') | ||
|
||
cy.get('button:first').scrollTo('bottom', { ensureScrollable: false }).then(() => { | ||
cy.stub(Cypress.ensure, 'isScrollable') | ||
|
||
expect(scrollTo).to.be.calledWithMatch({}, { ensureScrollable: false }) | ||
expect(Cypress.ensure.isScrollable).not.to.be.called | ||
}) | ||
}) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -168,7 +168,7 @@ describe('src/cypress/dom/visibility', () => { | |
} | ||
|
||
// ensure all tests run against a scrollable window | ||
const scrollThisIntoView = add('<div style=`height: 1000px;` /><div>Should be in view</div>') | ||
const scrollThisIntoView = add('<div style=`height: 1000px;`></div><div>Should be in view</div>') | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. jQuery no longer gracefully handles DOM that is not valid - so this would no longer create the accurate DOM to test against. This was just written wrong at some point. |
||
|
||
this.$visHidden = add('<ul style="visibility: hidden;"></ul>') | ||
this.$parentVisHidden = add('<div class="invis" style="visibility: hidden;"><button>parent visibility: hidden</button></div>') | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just fixing chaining of a test that was found to match our recommendations