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/css/css-anchor-position/position-fallback-bounds-006.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/css/css-anchor-position/position-fallback-bounds-006.html')
-rw-r--r-- | testing/web-platform/tests/css/css-anchor-position/position-fallback-bounds-006.html | 64 |
1 files changed, 64 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-anchor-position/position-fallback-bounds-006.html b/testing/web-platform/tests/css/css-anchor-position/position-fallback-bounds-006.html new file mode 100644 index 0000000000..5a19c59f31 --- /dev/null +++ b/testing/web-platform/tests/css/css-anchor-position/position-fallback-bounds-006.html @@ -0,0 +1,64 @@ +<!DOCTYPE html> +<title>Tests 'position-fallback-bounds' should work without default anchor</title> +<link rel="help" href="https://drafts.csswg.org/css-anchor-position-1/#fallback-bounds"> +<link rel="author" href="mailto:xiaochengh@chromium.org"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<script src="support/test-common.js"></script> + +<style> +body { + margin: 0; +} + +#bounds { + position: absolute; + left: 0; + right: 0; + top: 100px; + height: calc(100vh + 200px); + background: lightgray; + anchor-name: --bounds; +} + +#anchor { + position: fixed; + width: 100px; + height: 100px; + left: 0; + top: 100px; + background: orange; + anchor-name: --a; +} + +#target { + position: fixed; + width: 100px; + height: 100px; + background: lime; + position-fallback: --top-then-bottom; + position-fallback-bounds: --bounds; +} + +@position-fallback --top-then-bottom { + @try { bottom: anchor(--a top); } + @try { top: anchor(--a bottom); } +} +</style> + +<div id=bounds></div> +<div id=anchor></div> +<div id=target></div> + +<script> +promise_test(async () => { + await waitUntilNextAnimationFrame(); + assert_fallback_position(target, anchor, 'bottom'); +}, "Target is below anchor at initial scroll position"); + +promise_test(async () => { + document.documentElement.scrollTop = 100; + await waitUntilNextAnimationFrame(); + assert_fallback_position(target, anchor, 'top'); +}, "Target moves to above anchor after the additional fallback-bounds rect is scrolled upwards"); +</script> |