diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 00:47:55 +0000 |
commit | 26a029d407be480d791972afb5975cf62c9360a6 (patch) | |
tree | f435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/css-scroll-snap/snap-into-covering-area.tentative.html | |
parent | Initial commit. (diff) | |
download | firefox-26a029d407be480d791972afb5975cf62c9360a6.tar.xz firefox-26a029d407be480d791972afb5975cf62c9360a6.zip |
Adding upstream version 124.0.1.upstream/124.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-scroll-snap/snap-into-covering-area.tentative.html')
-rw-r--r-- | testing/web-platform/tests/css/css-scroll-snap/snap-into-covering-area.tentative.html | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-scroll-snap/snap-into-covering-area.tentative.html b/testing/web-platform/tests/css/css-scroll-snap/snap-into-covering-area.tentative.html new file mode 100644 index 0000000000..2cc8741f5e --- /dev/null +++ b/testing/web-platform/tests/css/css-scroll-snap/snap-into-covering-area.tentative.html @@ -0,0 +1,77 @@ +<!DOCTYPE html> +<html> + +<head> + <link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-type" /> + <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="/dom/events/scrolling/scroll_support.js"></script> +</head> + +<body> + <style> + #scroller { + overflow: scroll; + height: 500px; + width: 500px; + background-color: blue; + scroll-snap-type: y mandatory; + position: absolute; + } + + .snap_point { + scroll-snap-align: start; + width: 40%; + position: relative; + left: 30%; + } + + .big { + height: 1000%; + background-color: pink; + border: solid 1px red; + } + + .small { + height: 50%; + background-color: purple; + border: solid 1px black; + } + </style> + <div id="scroller"> + <div class="big snap_point" id="big_snap_point"></div> + <div class="small snap_point"> + <button id="scrollerButton">scrollerButton</button> + </div> + </div> + <script> + promise_test(async(t) => { + const x = scroller.clientWidth / 2; + const y = scroller.clientHeight / 2; + + // Scroll all the way down to the smaller snap area which doesn't cover + // the snapport. + let scrollend_promise = new Promise((resolve) => { + scroller.addEventListener("scrollend", resolve); + }); + scroller.scrollTop = scroller.scrollHeight; + await scrollend_promise; + + // Scroll up with one press of the arrow-up button. + scrollend_promise = new Promise((resolve) => { + scroller.addEventListener("scrollend", resolve); + }); + const arrowUp = '\uE013'; + await test_driver.send_keys(scrollerButton, arrowUp); + + await scrollend_promise; + assert_equals(scroller.scrollTop, big_snap_point.offsetHeight - scroller.clientHeight, + "scroller is snapped to the bottom of the larger snap area, not the top"); + }); + </script> +</body> + +</html>
\ No newline at end of file |