Skip to content

Truly independent web browser

LibWeb: Test live computed custom-property enumeration

Andreas Kling79bffb1cfff3
diff --git a/Tests/LibWeb/Text/expected/css/computed-custom-property-enumeration-is-live.txt b/Tests/LibWeb/Text/expected/css/computed-custom-property-enumeration-is-live.txt
new file mode 100644
index 00000000000..9214dc44ceb
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/css/computed-custom-property-enumeration-is-live.txt
@@ -0,0 +1,5 @@
+initial: ""
+specified: ""
+registered: ""
+stylesheet: ""
+removed: ""
diff --git a/Tests/LibWeb/Text/input/css/computed-custom-property-enumeration-is-live.html b/Tests/LibWeb/Text/input/css/computed-custom-property-enumeration-is-live.html
new file mode 100644
index 00000000000..a0c4163e62f
--- /dev/null
+++ b/Tests/LibWeb/Text/input/css/computed-custom-property-enumeration-is-live.html
@@ -0,0 +1,27 @@
+<!doctype html>
+<style id="registration">
+ @property --sheet-initial {
+ syntax: "<length>";
+ inherits: false;
+ initial-value: 2px;
+ }
+</style>
+<div id="target"></div>
+<script src="../include.js"></script>
+<script>
+ test(() => {
+ const target = document.getElementById("target");
+ const registration = document.getElementById("registration");
+ const style = getComputedStyle(target);
+ const names = () => Array.from(style).filter(name => name.startsWith("--")).sort().join(", ");
+ println(`initial: ${JSON.stringify(names())}`);
+ target.style.setProperty("--dynamic", "value");
+ println(`specified: ${JSON.stringify(names())}`);
+ CSS.registerProperty({ name: "--api-initial", syntax: "<length>", inherits: false, initialValue: "3px" });
+ println(`registered: ${JSON.stringify(names())}`);
+ registration.textContent = '@property --replacement-initial { syntax: "<length>"; inherits: false; initial-value: 4px; }';
+ println(`stylesheet: ${JSON.stringify(names())}`);
+ target.style.removeProperty("--dynamic");
+ println(`removed: ${JSON.stringify(names())}`);
+ });
+</script>