summaryrefslogtreecommitdiffstats
path: root/gfx/layers/apz/test/mochitest/helper_bug1719330.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 19:33:14 +0000
commit36d22d82aa202bb199967e9512281e9a53db42c9 (patch)
tree105e8c98ddea1c1e4784a60a5a6410fa416be2de /gfx/layers/apz/test/mochitest/helper_bug1719330.html
parentInitial commit. (diff)
downloadfirefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz
firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip
Adding upstream version 115.7.0esr.upstream/115.7.0esrupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'gfx/layers/apz/test/mochitest/helper_bug1719330.html')
-rw-r--r--gfx/layers/apz/test/mochitest/helper_bug1719330.html65
1 files changed, 65 insertions, 0 deletions
diff --git a/gfx/layers/apz/test/mochitest/helper_bug1719330.html b/gfx/layers/apz/test/mochitest/helper_bug1719330.html
new file mode 100644
index 0000000000..c99b6e1012
--- /dev/null
+++ b/gfx/layers/apz/test/mochitest/helper_bug1719330.html
@@ -0,0 +1,65 @@
+<!DOCTYPE HTML>
+<html>
+<head>
+ <meta charset="utf-8">
+ <title>Tests that the arrow down key does not scroll by more than 1 element</title>
+ <script src="/tests/SimpleTest/EventUtils.js"></script>
+ <script type="application/javascript" src="apz_test_utils.js"></script>
+ <script type="application/javascript" src="apz_test_native_event_utils.js"></script>
+ <script src="/tests/SimpleTest/paint_listener.js"></script>
+ <style>
+ .time-column {
+ width: 68px;
+ height: 28px;
+
+ overflow-y: scroll;
+ scroll-snap-type: y mandatory;
+
+ border-radius: 4px;
+ border: 1px solid red;
+ }
+
+ .time-item {
+ scroll-snap-align: center;
+ height: 100%;
+ }
+ </style>
+</head>
+<body>
+ <div class="time-column"></div>
+
+ <script type="application/javascript">
+
+ function waitForScrollEvent(target) {
+ return new Promise(resolve => {
+ target.addEventListener("scroll", resolve, { once: true });
+ });
+ }
+
+ async function test() {
+ const timeCol = document.querySelector('.time-column');
+
+ for (let i = 0; i < 60; i++) {
+ let item = document.createElement('div');
+ item.classList.add('time-item');
+ item.textContent = i;
+ timeCol.appendChild(item);
+ }
+
+ is(timeCol.scrollTop, 0, "should begin with no scroll (1)");
+
+ let waitForScroll = waitForScrollEvent(timeCol);
+
+ timeCol.focus();
+ window.synthesizeKey("KEY_ArrowDown");
+
+ await waitForScroll;
+
+ ok(timeCol.scrollTop > 0, "should have scrolled (2)");
+ ok(timeCol.scrollTop < 30, "should have not scrolled too far (3)");
+ }
+
+ waitUntilApzStable().then(test).then(subtestDone, subtestFailed);
+ </script>
+</body>
+</html>