summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/dom/events/scrolling/scrollend-event-fired-to-document.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/dom/events/scrolling/scrollend-event-fired-to-document.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/dom/events/scrolling/scrollend-event-fired-to-document.html')
-rw-r--r--testing/web-platform/tests/dom/events/scrolling/scrollend-event-fired-to-document.html70
1 files changed, 70 insertions, 0 deletions
diff --git a/testing/web-platform/tests/dom/events/scrolling/scrollend-event-fired-to-document.html b/testing/web-platform/tests/dom/events/scrolling/scrollend-event-fired-to-document.html
new file mode 100644
index 0000000000..3090455388
--- /dev/null
+++ b/testing/web-platform/tests/dom/events/scrolling/scrollend-event-fired-to-document.html
@@ -0,0 +1,70 @@
+<!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>
+#targetDiv {
+ width: 200px;
+ height: 200px;
+ overflow: scroll;
+}
+
+#innerDiv {
+ width: 400px;
+ height: 400px;
+}
+</style>
+
+<body style="margin:0" onload=runTest()>
+<div id="targetDiv">
+ <div id="innerDiv">
+ </div>
+</div>
+</body>
+
+<script>
+var target_div = document.getElementById('targetDiv');
+var horizontal_scrollend_arrived = false;
+var vertical_scrollend_arrived = false;
+function onHorizontalScrollEnd(event) {
+ assert_false(event.cancelable);
+ // scrollend events are bubbled when the target node is document.
+ assert_true(event.bubbles);
+ horizontal_scrollend_arrived = true;
+}
+function onVerticalScrollEnd(event) {
+ assert_false(event.cancelable);
+ // scrollend events are bubbled when the target node is document.
+ assert_true(event.bubbles);
+ vertical_scrollend_arrived = true;
+}
+
+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.');
+ assert_equals(target_div.scrollTop, 0);
+ }, 'Tests that the document gets scrollend event when no element scrolls by ' +
+ 'touch.');
+}
+</script>