summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-variables/variable-reference-cssom.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-07 09:22:09 +0000
commit43a97878ce14b72f0981164f87f2e35e14151312 (patch)
tree620249daf56c0258faa40cbdcf9cfba06de2a846 /testing/web-platform/tests/css/css-variables/variable-reference-cssom.html
parentInitial commit. (diff)
downloadfirefox-43a97878ce14b72f0981164f87f2e35e14151312.tar.xz
firefox-43a97878ce14b72f0981164f87f2e35e14151312.zip
Adding upstream version 110.0.1.upstream/110.0.1upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'testing/web-platform/tests/css/css-variables/variable-reference-cssom.html')
-rw-r--r--testing/web-platform/tests/css/css-variables/variable-reference-cssom.html54
1 files changed, 54 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-variables/variable-reference-cssom.html b/testing/web-platform/tests/css/css-variables/variable-reference-cssom.html
new file mode 100644
index 0000000000..00354beaf8
--- /dev/null
+++ b/testing/web-platform/tests/css/css-variables/variable-reference-cssom.html
@@ -0,0 +1,54 @@
+<!DOCTYPE html>
+<html>
+<head>
+ <title>CSS variable references - via CSSOM</title>
+
+ <meta rel="author" title="Kevin Babbitt">
+ <meta rel="author" title="Greg Whitworth">
+ <link rel="author" title="Microsoft Corporation" href="http://microsoft.com" />
+ <!-- This is not directly specified in the spec but should work -->
+ <link rel="help" href="http://www.w3.org/TR/css-variables-1/#defining-variables">
+
+ <script src="/resources/testharness.js"></script>
+ <script src="/resources/testharnessreport.js"></script>
+</head>
+<body>
+
+<div id="target1"></div>
+<div id="target2" style="background-color: red;"></div>
+
+<script type="text/javascript">
+ "use strict";
+
+ // This test verifies that variable references are usable when set via CSSOM calls.
+
+ function TestCssom() {
+ var target = document.getElementById("target1");
+
+ target.style.setProperty("background-color", "var(--prop)");
+ assert_equals(target.style.backgroundColor, "var(--prop)", "background-color property value after calling setProperty");
+ assert_equals(target.style.getPropertyValue("background-color"), "var(--prop)", "getPropertyValue('background-color') after calling setProperty");
+
+ target.style.removeProperty("background-color");
+ assert_equals(target.style.backgroundColor, "", "background-color property value after calling removeProperty");
+ assert_equals(target.style.getPropertyValue("background-color"), "", "getPropertyValue('background-color') after calling removeProperty");
+ }
+
+ function TestCssomOverridingMarkup() {
+ var target = document.getElementById("target1");
+
+ target.style.setProperty("background-color", "var(--prop)");
+ assert_equals(target.style.backgroundColor, "var(--prop)", "background-color property value after calling setProperty");
+ assert_equals(target.style.getPropertyValue("background-color"), "var(--prop)", "getPropertyValue('background-color') after calling setProperty");
+
+ target.style.removeProperty("background-color");
+ assert_equals(target.style.backgroundColor, "", "background-color property value after calling removeProperty");
+ assert_equals(target.style.getPropertyValue("background-color"), "", "getPropertyValue('background-color') after calling removeProperty");
+ }
+
+ test(TestCssom, "Verify correct results using CSSOM");
+ test(TestCssomOverridingMarkup, "Verify correct results with CSSOM overriding markup-set values");
+</script>
+
+</body>
+</html>