summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-properties-values-api/registered-property-change-style-001.html
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-19 01:47:29 +0000
commit0ebf5bdf043a27fd3dfb7f92e0cb63d88954c44d (patch)
treea31f07c9bcca9d56ce61e9a1ffd30ef350d513aa /testing/web-platform/tests/css/css-properties-values-api/registered-property-change-style-001.html
parentInitial commit. (diff)
downloadfirefox-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/css-properties-values-api/registered-property-change-style-001.html')
-rw-r--r--testing/web-platform/tests/css/css-properties-values-api/registered-property-change-style-001.html50
1 files changed, 50 insertions, 0 deletions
diff --git a/testing/web-platform/tests/css/css-properties-values-api/registered-property-change-style-001.html b/testing/web-platform/tests/css/css-properties-values-api/registered-property-change-style-001.html
new file mode 100644
index 0000000000..320b44d82e
--- /dev/null
+++ b/testing/web-platform/tests/css/css-properties-values-api/registered-property-change-style-001.html
@@ -0,0 +1,50 @@
+<!DOCTYPE html>
+<meta charset="utf-8">
+<title>CSS Variables Test: Style changes on registered properties using variables</title>
+<link rel="author" title="Javier Fernandez Garcia-Boente" href="mailto:jfernandez@igalia.com">
+<link rel="help" href="http://www.w3.org/TR/css-variables-1/#using-variables">
+<meta name="assert" content="A change in the custom property declaration must be propagated to all the descendants">
+<script src="/resources/testharness.js"></script>
+<script src="/resources/testharnessreport.js"></script>
+<div id="outer">
+ <div id="inbetween">
+ <div id="inner"></div>
+ </div>
+</div>
+<script>
+ "use strict";
+ test( function () {
+ outer.style.cssText = '';
+ inbetween.style.cssText = '';
+ inner.style.cssText = 'color: var(--color1)';
+ let initialValue = getComputedStyle(inner).getPropertyValue('color');
+ assert_equals(initialValue, "rgb(0, 0, 0)", "Initial value");
+
+ inbetween.style.cssText = 'color: green';
+ let inheritedValue = getComputedStyle(inner).getPropertyValue('color');
+ assert_equals(inheritedValue, "rgb(0, 128, 0)", "Inherited value");
+
+ CSS.registerProperty({name: '--color1', syntax: '<color>', initialValue: 'red', inherits: true});
+ let actualValue = getComputedStyle(inner).getPropertyValue('color');
+ assert_equals(actualValue, "rgb(255, 0, 0)", "Resolved value");
+ }, "New registered property declaration");
+
+ test( function () {
+ outer.style.cssText = '';
+ inbetween.style.cssText = '';
+ inner.style.cssText = 'color: var(--color2)';
+ let initialValue = getComputedStyle(inner).getPropertyValue('color');
+ assert_equals(initialValue, "rgb(0, 0, 0)", "Initial value");
+
+ outer.style.cssText = '--color2: blue';
+ inbetween.style.cssText = 'color: green';
+ let resolvedValue = getComputedStyle(inner).getPropertyValue('color');
+ assert_equals(resolvedValue, "rgb(0, 0, 255)", "Resolved value");
+
+ outer.style.cssText = '';
+ CSS.registerProperty({name: '--color2', syntax: '<color>', initialValue: 'red', inherits: true});
+ let actualValue = getComputedStyle(inner).getPropertyValue('color');
+ assert_equals(actualValue, "rgb(255, 0, 0)", "Resolved value");
+ }, "Registered property overrides a previous declaration ");
+</script>
+