diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:13:27 +0000 |
commit | 40a355a42d4a9444dc753c04c6608dade2f06a23 (patch) | |
tree | 871fc667d2de662f171103ce5ec067014ef85e61 /testing/web-platform/tests/css/css-anchor-position/position-try-dynamic.html | |
parent | Adding upstream version 124.0.1. (diff) | |
download | firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.tar.xz firefox-40a355a42d4a9444dc753c04c6608dade2f06a23.zip |
Adding upstream version 125.0.1.upstream/125.0.1
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-anchor-position/position-try-dynamic.html')
-rw-r--r-- | testing/web-platform/tests/css/css-anchor-position/position-try-dynamic.html | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-anchor-position/position-try-dynamic.html b/testing/web-platform/tests/css/css-anchor-position/position-try-dynamic.html new file mode 100644 index 0000000000..fad3db62a3 --- /dev/null +++ b/testing/web-platform/tests/css/css-anchor-position/position-try-dynamic.html @@ -0,0 +1,35 @@ +<!DOCTYPE html> +<title>CSS Anchor Positioning Test: Dynamically change position via position-try-options property</title> +<link rel="help" href="https://drafts.csswg.org/css-anchor-1/#fallback"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + body { margin: 0; } + + @position-try --fallback1 { + left: anchor(--a1 right); + } + #anchor { + anchor-name: --a1; + width: 100px; + height: 100px; + } + #anchored { + position: absolute; + left: 999999px; /* Force fallback */ + width: 100px; + height: 100px; + } +</style> +<div id="anchor"></div> +<div id="anchored"></div> +<script> + test(() => { + assert_equals(anchored.offsetLeft, 999999); + }, "Initial static left position is 0"); + + test(() => { + anchored.style.positionTryOptions = "--fallback1"; + assert_equals(anchored.offsetLeft, 100); + }, "Left position set to right edge of anchor with @position-try"); +</script> |