Skip to content

Commit

Permalink
Bug 1761042 [wpt PR 33328] - Remove redundant tests for scrollend / o…
Browse files Browse the repository at this point in the history
…verscroll events fired to document., a=testonly

Automatic update from web-platform-tests
Remove redundant tests for scrollend / overscroll events fired to document.

The WPT version of the scrollend test could erroneously pass even if the
second scroll in the test did not fire a scrollend event. Fixed by
ensuring that the scrollend listeners for the directional scrolls are
not both armed at the same time.

Bug: 1309479
Change-Id: I1a4c929cbb39d1173269575a2be289a090d1394b
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3546082
Reviewed-by: Steve Kobes <skobes@chromium.org>
Commit-Queue: Kevin Ellis <kevers@chromium.org>
Cr-Commit-Position: refs/heads/main@{#986672}

--

wpt-commits: d5d1e2cd0ff9f729f1ac31bc3f1695bf6fa98c1b
wpt-pr: 33328
  • Loading branch information
kevers-google authored and moz-wptsync-bot committed Apr 1, 2022
1 parent ceb362f commit 0b3a849
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -41,22 +41,24 @@
assert_true(event.bubbles);
vertical_scrollend_arrived = true;
}
document.addEventListener("scrollend", onHorizontalScrollEnd);
document.addEventListener("scrollend", onVerticalScrollEnd);

function runTest() {
promise_test (async (t) => {
// Make sure that no scrollend event is sent to target_div.
target_div.addEventListener("scrollend",
t.unreached_func("target_div got unexpected scrollend event."));
await waitForCompositorCommit();

// Scroll left on target div and wait for the doc to get scrollend event.
document.addEventListener("scrollend", onHorizontalScrollEnd);
await touchScrollInTarget(300, target_div, 'left');
await waitFor(() => { return horizontal_scrollend_arrived; },
'Document did not receive scrollend event after scroll left on target.');
assert_equals(target_div.scrollLeft, 0);
document.removeEventListener("scrollend", onHorizontalScrollEnd);

// Scroll up on target div and wait for the doc to get scrollend event.
document.addEventListener("scrollend", onVerticalScrollEnd);
await touchScrollInTarget(300, target_div, 'up');
await waitFor(() => { return vertical_scrollend_arrived; },
'Document did not receive scrollend event after scroll up on target.');
Expand Down

0 comments on commit 0b3a849

Please sign in to comment.