summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scroll-snap/unreachable-snap-positions-002.html
diff options
context:
space:
mode:
Diffstat (limited to 'testing/web-platform/tests/css/css-scroll-snap/unreachable-snap-positions-002.html')
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap/unreachable-snap-positions-002.html67
1 files changed, 67 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-scroll-snap/unreachable-snap-positions-002.html b/testing/web-platform/tests/css/css-scroll-snap/unreachable-snap-positions-002.html
new file mode 100644
index 0000000000..a3726d71b3
--- /dev/null
+++ b/testing/web-platform/tests/css/css-scroll-snap/unreachable-snap-positions-002.html
@@ -0,0 +1,67 @@
+<!DOCTYPE html>
+<meta name="viewport" content="width=device-width, initial-scale=1">
+<link rel="help" href="https://drafts.csswg.org/css-scroll-snap/#unreachable" />
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+.scroller {
+ width: 100vw;
+ height: 100px;
+ display: flex;
+ scroll-snap-type: x mandatory;
+ overflow-x: auto;
+}
+.scroller.rtl {
+ direction: rtl;
+}
+.scroller.end > span {
+ scroll-snap-align: end;
+}
+.scroller.center > span {
+ scroll-snap-align: end;
+}
+</style>
+<div class="scroller end">
+ <span style="min-width: 25px;"></span>
+ <span style="min-width: 100vw;"></span>
+</div>
+<div class="scroller center">
+ <span style="min-width: 25px;"></span>
+ <span style="min-width: 100vw;"></span>
+</div>
+<div class="scroller end rtl">
+ <span style="min-width: 25px;"></span>
+ <span style="min-width: 100vw;"></span>
+</div>
+<div class="scroller center rtl">
+ <span style="min-width: 25px;"></span>
+ <span style="min-width: 100vw;"></span>
+</div>
+<script>
+
+test(() => {
+ const scroller = document.querySelector(".scroller.end");
+ assert_equals(scroller.scrollLeft, 0);
+ assert_equals(scroller.scrollTop, 0);
+}, "Unreachable snap point with `scroll-snap-align: end`");
+
+test(() => {
+ const scroller = document.querySelector(".scroller.center");
+ assert_equals(scroller.scrollLeft, 0);
+ assert_equals(scroller.scrollTop, 0);
+}, "Unreachable snap point with `scroll-snap-align: center`");
+
+test(() => {
+ const scroller = document.querySelector(".scroller.end.rtl");
+ assert_equals(scroller.scrollLeft, 0);
+ assert_equals(scroller.scrollTop, 0);
+}, "Unreachable snap point with `scroll-snap-align: end` in RTL");
+
+test(() => {
+ const scroller = document.querySelector(".scroller.center.rtl");
+ assert_equals(scroller.scrollLeft, 0);
+ assert_equals(scroller.scrollTop, 0);
+}, "Unreachable snap point with `scroll-snap-align: center` in RTL");
+
+</script>
+</html>