diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-19 01:47:29 +0000 |
commit | 0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch) | |
tree | a31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html | |
parent | Initial commit. (diff) | |
download | firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.tar.xz firefox-esr-0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d.zip |
Adding upstream version 115.8.0esr.upstream/115.8.0esr
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html')
-rw-r--r-- | testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html b/testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html new file mode 100644 index 0000000000..5aa4ad2532 --- /dev/null +++ b/testing/web-platform/tests/css/cssom/cssstyledeclaration-registered-custom-properties.html @@ -0,0 +1,58 @@ +<!DOCTYPE html> +<title>Computed CSSStyleDeclaration includes registered custom properties</title> +<link rel="help" href="https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle"> +<link rel="help" href="https://github.com/w3c/csswg-drafts/issues/1316"> +<script src="/resources/testharness.js"></script> +<script src="/resources/testharnessreport.js"></script> +<style> + @property --non-inherited-length { + syntax: "<length>"; + inherits: false; + initial-value: 0px; + } + @property --inherited-length { + syntax: "<length>"; + inherits: true; + initial-value: 0px; + } + @property --universal-with-initial { + syntax: "*"; + inherits: false; + initial-value: foo; + } + @property --universal-without-initial { + syntax: "*"; + inherits: false; + } + #outer { --non-registered-outer: 1px; } + #inner { --non-registered-inner: 2px; } + #sibling { --universal-without-initial: bar; } +</style> +<div id=outer> + <div id=inner></div> + <div id=sibling></div> +</div> +<script> + const assert_present = (props, name) => assert_not_equals(props.indexOf(name), -1); + const assert_absent = (props, name) => assert_equals(props.indexOf(name), -1); + + test(function() { + let props = Array.from(getComputedStyle(inner)); + assert_present(props, '--non-inherited-length'); + assert_present(props, '--inherited-length'); + assert_present(props, '--non-registered-outer'); + assert_present(props, '--non-registered-inner'); + assert_present(props, '--universal-with-initial'); + assert_absent(props, '--universal-without-initial'); + }, 'Registered custom properties are included in CSSComputedStyleDeclaration'); + + test(function() { + let props = Array.from(getComputedStyle(sibling)); + assert_present(props, '--non-inherited-length'); + assert_present(props, '--inherited-length'); + assert_present(props, '--non-registered-outer'); + assert_present(props, '--universal-with-initial'); + assert_present(props, '--universal-without-initial'); + assert_absent(props, '--non-registered-inner'); + }, 'Only relevant custom properties are included'); +</script> |