summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-scroll-snap/scroll-margin-visibility-check.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-margin-visibility-check.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-margin-visibility-check.html')
-rw-r--r--testing/web-platform/tests/css/css-scroll-snap/scroll-margin-visibility-check.html44
1 files changed, 44 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-scroll-snap/scroll-margin-visibility-check.html b/testing/web-platform/tests/css/css-scroll-snap/scroll-margin-visibility-check.html
new file mode 100644
index 0000000000..b41ccb36fd
--- /dev/null
+++ b/testing/web-platform/tests/css/css-scroll-snap/scroll-margin-visibility-check.html
@@ -0,0 +1,44 @@
+<!DOCTYPE html>
+<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1/#scroll-margin">
+<link rel="help" href="https://drafts.csswg.org/css-scroll-snap-1/#scroll-padding">
+<link rel="help" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1708303">
+<link rel="author" href="mailto:emilio@crisal.io" title="Emilio Cobos Álvarez">
+<link rel="author" href="https://mozilla.org" title="Mozilla">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<style>
+body { margin: 0 }
+#scroller {
+ height: 500px;
+ width: 500px;
+ scrollbar-width: none;
+ overflow: scroll;
+}
+#target {
+ width: 100px;
+ height: 100px;
+ background-color: blue;
+ scroll-margin: 100px;
+ margin-left: 510px;
+}
+</style>
+
+<div id="scroller">
+ <div style="width: 450px; height: 450px;"></div>
+ <div tabindex="0" id="target"></div>
+ <div style="width: 2000px; height: 2000px;"></div>
+</div>
+
+<script>
+let scroller = document.getElementById("scroller");
+let target = document.getElementById("target");
+promise_test(async function() {
+ scroller.scrollTo(0, 0);
+ await new Promise(resolve => {
+ scroller.addEventListener("scroll", resolve, { once: true });
+ document.getElementById("target").focus();
+ });
+ assert_true(scroller.scrollTop > 0, "Visibility check should not account for margin");
+ assert_true(scroller.scrollLeft > 0, "Visibility check should not account for margin");
+});
+</script>