diff options
Diffstat (limited to 'testing/web-platform/tests/dom/events/scrolling/scroll_support.js')
-rw-r--r-- | testing/web-platform/tests/dom/events/scrolling/scroll_support.js | 12 |
1 files changed, 5 insertions, 7 deletions
diff --git a/testing/web-platform/tests/dom/events/scrolling/scroll_support.js b/testing/web-platform/tests/dom/events/scrolling/scroll_support.js index e86ead5456..e536b7d748 100644 --- a/testing/web-platform/tests/dom/events/scrolling/scroll_support.js +++ b/testing/web-platform/tests/dom/events/scrolling/scroll_support.js @@ -26,17 +26,15 @@ async function waitForPointercancelEvent(test, target, timeoutMs = 500) { // Resets the scroll position to (0,0). If a scroll is required, then the // promise is not resolved until the scrollend event is received. -async function waitForScrollReset(test, scroller, timeoutMs = 500) { +async function waitForScrollReset(test, scroller, x = 0, y = 0) { return new Promise(resolve => { - if (scroller.scrollTop == 0 && - scroller.scrollLeft == 0) { + if (scroller.scrollTop == x && scroller.scrollLeft == y) { resolve(); } else { const eventTarget = scroller == document.scrollingElement ? document : scroller; - scroller.scrollTop = 0; - scroller.scrollLeft = 0; - waitForScrollendEvent(test, eventTarget, timeoutMs).then(resolve); + scroller.scrollTo(x, y); + waitForScrollendEventNoTimeout(eventTarget).then(resolve); } }); } @@ -121,7 +119,7 @@ function waitForCompositorCommit() { // deferred running the tests until after paint holding. async function waitForCompositorReady() { const animation = - document.body.animate({ opacity: [ 1, 1 ] }, {duration: 1 }); + document.body.animate({ opacity: [ 0, 1 ] }, {duration: 1 }); return animation.finished; } |