mirror of
https://github.com/nodejs/node.git
synced 2025-08-15 13:48:44 +02:00

This updates the tests and the status file via running `git node wpt dom/events`. PR-URL: https://github.com/nodejs/node/pull/46051 Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
68 lines
2.3 KiB
HTML
68 lines
2.3 KiB
HTML
<!DOCTYPE HTML>
|
|
<meta name="viewport" content="width=device-width,initial-scale=1,minimum-scale=1">
|
|
<script src="/resources/testharness.js"></script>
|
|
<script src="/resources/testharnessreport.js"></script>
|
|
<script src="/resources/testdriver.js"></script>
|
|
<script src="/resources/testdriver-actions.js"></script>
|
|
<script src="/resources/testdriver-vendor.js"></script>
|
|
<script src="scroll_support.js"></script>
|
|
<style>
|
|
#scrollableDiv {
|
|
width: 200px;
|
|
height: 200px;
|
|
overflow: scroll;
|
|
}
|
|
|
|
#innerDiv {
|
|
width: 400px;
|
|
height: 400px;
|
|
}
|
|
</style>
|
|
|
|
<body style="margin:0" onload=runTest()>
|
|
<div id="scrollableDiv">
|
|
<div id="innerDiv">
|
|
</div>
|
|
</div>
|
|
</body>
|
|
|
|
<script>
|
|
var scrolling_div = document.getElementById('scrollableDiv');
|
|
var horizontal_scrollend_arrived = false;
|
|
var vertical_scrollend_arrived = false;
|
|
function onHorizontalScrollEnd(event) {
|
|
assert_false(event.cancelable);
|
|
assert_false(event.bubbles);
|
|
horizontal_scrollend_arrived = true;
|
|
}
|
|
function onVerticalScrollEnd(event) {
|
|
assert_false(event.cancelable);
|
|
assert_false(event.bubbles);
|
|
vertical_scrollend_arrived = true;
|
|
}
|
|
scrolling_div.addEventListener("scrollend", onHorizontalScrollEnd);
|
|
scrolling_div.addEventListener("scrollend", onVerticalScrollEnd);
|
|
|
|
function runTest() {
|
|
promise_test (async (t) => {
|
|
// Make sure that no scrollend event is sent to document.
|
|
document.addEventListener("scrollend",
|
|
t.unreached_func("Document got unexpected scrollend event."));
|
|
await waitForCompositorCommit();
|
|
|
|
// Do a horizontal scroll and wait for scrollend event.
|
|
await touchScrollInTarget(300, scrolling_div, 'right');
|
|
await waitFor(() => { return horizontal_scrollend_arrived; },
|
|
'Scroller did not receive scrollend event after horizontal scroll.');
|
|
assert_equals(scrolling_div.scrollWidth - scrolling_div.scrollLeft,
|
|
scrolling_div.clientWidth);
|
|
|
|
// Do a vertical scroll and wait for scrollend event.
|
|
await touchScrollInTarget(300, scrolling_div, 'down');
|
|
await waitFor(() => { return vertical_scrollend_arrived; },
|
|
'Scroller did not receive scrollend event after vertical scroll.');
|
|
assert_equals(scrolling_div.scrollHeight - scrolling_div.scrollTop,
|
|
scrolling_div.clientHeight);
|
|
}, 'Tests that the scrolled element gets scrollend event at the end of touch scrolling.');
|
|
}
|
|
</script>
|