summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scroll-snap/scroll-snap-stop-002-nested.tentative.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 00:47:55 +0000
commit26a029d407be480d791972afb5975cf62c9360a6 (patch)
treef435a8308119effd964b339f76abb83a57c29483 /testing/web-platform/tests/css/css-scroll-snap/scroll-snap-stop-002-nested.tentative.html
parentInitial commit. (diff)
downloadfirefox-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/scroll-snap-stop-002-nested.tentative.html')
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap/scroll-snap-stop-002-nested.tentative.html61
1 files changed, 61 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-scroll-snap/scroll-snap-stop-002-nested.tentative.html b/testing/web-platform/tests/css/css-scroll-snap/scroll-snap-stop-002-nested.tentative.html
new file mode 100644
index 0000000000..34b6dc97e2
--- /dev/null
+++ b/testing/web-platform/tests/css/css-scroll-snap/scroll-snap-stop-002-nested.tentative.html
@@ -0,0 +1,61 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-scroll-snap/#scroll-snap-stop" />
+<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1/#snap-overflow" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+div {
+ position: absolute;
+}
+.scroller {
+ width: 400px;
+ height: 100px;
+ overflow: scroll;
+ scroll-snap-type: x mandatory;
+}
+#space {
+ left: 0px;
+ top: 0px;
+ width: 2100px;
+ height: 50px;
+}
+.target {
+ width: 50px;
+ height: 50px;
+ scroll-snap-align: start;
+ top: 0px;
+}
+</style>
+
+<div class="scroller" id="scroller7">
+ <div id="space"></div>
+ <div class="target" style="left: 0px;"></div>
+ <div class="target" style="left: 400px; width: 900px;"></div>
+ <div class="target" style="left: 900px; scroll-snap-stop: always;"></div
+</div>
+
+<script>
+
+test(() => {
+ assert_equals(scroller7.scrollLeft, 0);
+ assert_equals(scroller7.scrollTop, 0);
+
+ // start dest always
+ // |-------------------------|================|=====|=====
+ // 0 400 700 900
+
+ // Scoll on the element whose snap area is larger than the snapport.
+ scroller7.scrollBy(600, 0);
+ // Stops before the smaller snap area @ 900px enters the snapport.
+ assert_equals(scroller7.scrollLeft + scroller7.clientWidth, 900);
+ assert_equals(scroller7.scrollTop, 0);
+
+ scroller7.scrollTo(0, 0);
+ scroller7.scrollBy(800, 0);
+ // Now the smaller snap area is closer, so we snap to it.
+ assert_equals(scroller7.scrollLeft, 900);
+ assert_equals(scroller7.scrollTop, 0);
+}, "`scroll-snap-stop: always` snap point is further than the scroll " +
+ "destination and a snap area covers the snapport");
+
+</script>