Update web-platform-tests to revision b'ee6da9d71d0268d7fdb04e8e5b26858f46ee0cc4'

This commit is contained in:
WPT Sync Bot 2022-01-20 04:38:55 +00:00 committed by cybai
parent 4401622eb1
commit b77ad115f6
16832 changed files with 270819 additions and 87621 deletions

View file

@ -31,32 +31,55 @@ const topRight = document.getElementById("top-right");
scrollLeft = () => scroller.scrollLeft;
scrollTop = () => scroller.scrollTop;
function ScrollCounter(test, eventTarget) {
this.count = 0;
const scrollListener = () => {
this.count++;
}
eventTarget.addEventListener('scroll', scrollListener);
test.add_cleanup(() => {
eventTarget.removeEventListener('scroll', scrollListener);
});
}
promise_test(async t => {
scroller.scrollTo(0, 0);
assert_equals(scroller.scrollTop, 0, "verify test pre-condition");
const scrollCounter = new ScrollCounter(t, scroller);
await keyPress(scroller, "ArrowDown");
await waitForScrollEnd(scroller, scrollTop, 400);
// Make sure we don't jump directly to the new snap position.
assert_greater_than(scrollCounter.count, 2);
}, "Snaps to bottom-left after pressing ArrowDown");
promise_test(async t => {
scroller.scrollTo(0, 400);
assert_equals(scroller.scrollTop, 400, "verify test pre-condition");
const scrollCounter = new ScrollCounter(t, scroller);
await keyPress(scroller, "ArrowUp");
await waitForScrollEnd(scroller, scrollTop, 0);
// Make sure we don't jump directly to the new snap position.
assert_greater_than(scrollCounter.count, 2);
}, "Snaps to top-left after pressing ArrowUp");
promise_test(async t => {
scroller.scrollTo(0, 0);
assert_equals(scroller.scrollTop, 0, "verify test pre-condition");
const scrollCounter = new ScrollCounter(t, scroller);
await keyPress(scroller, "ArrowRight");
await waitForScrollEnd(scroller, scrollLeft, 400);
// Make sure we don't jump directly to the new snap position.
assert_greater_than(scrollCounter.count, 2);
}, "Snaps to top-right after pressing ArrowRight");
promise_test(async t => {
scroller.scrollTo(400, 0);
assert_equals(scroller.scrollLeft, 400, "verify test pre-condition");
const scrollCounter = new ScrollCounter(t, scroller);
await keyPress(scroller, "ArrowLeft");
await waitForScrollEnd(scroller, scrollLeft, 0);
// Make sure we don't jump directly to the new snap position.
assert_greater_than(scrollCounter.count, 2);
}, "Snaps to top-left after pressing ArrowLeft");
promise_test(async t => {