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/intersection-observer/rtl-clipped-root.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/intersection-observer/rtl-clipped-root.html')
-rw-r--r-- | testing/web-platform/tests/intersection-observer/rtl-clipped-root.html | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/testing/web-platform/tests/intersection-observer/rtl-clipped-root.html b/testing/web-platform/tests/intersection-observer/rtl-clipped-root.html new file mode 100644 index 0000000000..a30c6e38c5 --- /dev/null +++ b/testing/web-platform/tests/intersection-observer/rtl-clipped-root.html @@ -0,0 +1,66 @@ +<!DOCTYPE html> +<html dir="rtl"> +<head> + <meta name="viewport" content="width=device-width,initial-scale=1"> + <script src="/resources/testharness.js"></script> + <script src="/resources/testharnessreport.js"></script> + <script src="./resources/intersection-observer-test-utils.js"></script> + + <style> + pre, #log { + position: absolute; + top: 120px; + left: 0; + } + #root { + width: 350px; + height: 100px; + border: 1px solid black; + display: flex; + flex-direction: row; + overflow-x: auto; + } + #target-start, #target-end { + width: 100px; + height: 100px; + flex-shrink: 0; + background-color: green; + text-align: center; + } + #target-end { + margin-inline-start: 500px; + } + </style> +</head> + +<div id="root"> + <div id="target-start">start</div> + <div id="target-end">end</div> +</div> + +<script> +runTestCycle(function() { + let io = new IntersectionObserver(entries => { + entries.forEach(entry => { + if (entry.isIntersecting) { + entry.target.classList.add("intersecting"); + } else { + entry.target.classList.remove("intersecting"); + } + }); + }, { root: document.getElementById("root") }); + document.querySelectorAll("#root > div").forEach(element => { + io.observe(element); + }); + runTestCycle(step0, "First rAF"); +}, "Explicit rtl root with overflow clipping"); + +function step0() { + assert_true( + document.getElementById("target-start").classList.contains("intersecting"), + "Target at scroll start is intersecting"); + assert_false( + document.getElementById("target-end").classList.contains("intersecting"), + "Target at scroll end is not intersecting"); +} +</script> |