diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 19:33:14 +0000 |
commit | 36d22d82aa202bb199967e9512281e9a53db42c9 (patch) | |
tree | 105e8c98ddea1c1e4784a60a5a6410fa416be2de /layout/style/test/test_query_container_for.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.tar.xz firefox-esr-36d22d82aa202bb199967e9512281e9a53db42c9.zip |
Adding upstream version 115.7.0esr.upstream/115.7.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'layout/style/test/test_query_container_for.html')
-rw-r--r-- | layout/style/test/test_query_container_for.html | 62 |
1 files changed, 62 insertions, 0 deletions
diff --git a/layout/style/test/test_query_container_for.html b/layout/style/test/test_query_container_for.html new file mode 100644 index 0000000000..90dca9fab9 --- /dev/null +++ b/layout/style/test/test_query_container_for.html @@ -0,0 +1,62 @@ +<!doctype html> +<title>Test for bug 1789191</title> +<script src="/tests/SimpleTest/SimpleTest.js"></script> +<link rel="stylesheet" href="/tests/SimpleTest/test.css"/> +<style> +@container (min-width: 0px) { +} + +@container name (min-width: 0px) { +} + +@container (min-height: 0px) { +} + +div { + width: 100px; + height: 100px; + background-color: blue; + margin: 10px; +} + +.container-height { + container-type: size; +} + +.container-unnamed { + container-type: inline-size; +} + +.container-named { + container-type: inline-size; + container-name: name; +} +</style> + +<div id="child1"></div> + +<div class="container-height" id="container1"> + <div class="container-named" id="container2"> + <div class="container-unnamed" id="container3"> + <div id="child2"></div> + </div> + </div> +</div> + +<script> + let sheet = document.querySelector("style").sheet; + let withoutFilter = SpecialPowers.wrap(sheet.cssRules[0]); + let withFilter = SpecialPowers.wrap(sheet.cssRules[1]); + let heightQuery = SpecialPowers.wrap(sheet.cssRules[2]); + + // Container query selection requires up-to-date layout information. + document.body.getBoundingClientRect(); + + is(withoutFilter.queryContainerFor(child1), null, "No filter, no container"); + is(withFilter.queryContainerFor(child1), null, "Filter, no container"); + is(heightQuery.queryContainerFor(child1), null, "Height, no container"); + + is(SpecialPowers.unwrap(withoutFilter.queryContainerFor(child2)), container3, "No filter, container"); + is(SpecialPowers.unwrap(withFilter.queryContainerFor(child2)), container2, "Filter"); + is(SpecialPowers.unwrap(heightQuery.queryContainerFor(child2)), container1, "Height"); +</script> |