aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorbptato <nincsnevem662@gmail.com>2025-01-19 14:40:26 +0100
committerbptato <nincsnevem662@gmail.com>2025-01-19 14:43:01 +0100
commitad119c9a299458b4beca9fe8da85f74a33a8d91b (patch)
tree207bcec7e1a43db4754e97898146e0ff491390c7 /test
parent30e3ff6d8d77adc05db79ace1ed54beb609eb84d (diff)
downloadchawan-ad119c9a299458b4beca9fe8da85f74a33a8d91b.tar.gz
dom: CSSStyleDeclaration improvements
Now getComputedStyle works with pseudo-elements too.
Diffstat (limited to 'test')
-rw-r--r--test/js/config.toml6
-rw-r--r--test/js/style.app.html16
-rw-r--r--test/js/style.html16
3 files changed, 37 insertions, 1 deletions
diff --git a/test/js/config.toml b/test/js/config.toml
index 6eca170e..0224c241 100644
--- a/test/js/config.toml
+++ b/test/js/config.toml
@@ -2,9 +2,13 @@
history = false
[[siteconf]]
-match = "file:///.*"
+match = 'file:///.*'
scripting = true
+[[siteconf]]
+match = 'file:///.*\.app\.html'
+scripting = 'app'
+
[display]
columns = 80
lines = 24
diff --git a/test/js/style.app.html b/test/js/style.app.html
new file mode 100644
index 00000000..51df01a6
--- /dev/null
+++ b/test/js/style.app.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<style>
+#y::before { color: blue }
+</style>
+<title>Style test</title>
+<div id=x>Fail</div>
+<div id=y style="color: red; display: inline">test</div>
+<script src=asserts.js></script>
+<script>
+const y = document.getElementById("y");
+assertEquals(y.style.cssText, "color: red; display: inline;");
+assertEquals(window.getComputedStyle(y).cssText, "");
+assertEquals(window.getComputedStyle(y, "::before").color, "rgb(0, 0, 255)");
+y.remove();
+document.getElementById("x").textContent = "Success";
+</script>
diff --git a/test/js/style.html b/test/js/style.html
new file mode 100644
index 00000000..dad596df
--- /dev/null
+++ b/test/js/style.html
@@ -0,0 +1,16 @@
+<!doctype html>
+<style>
+y::before { color: blue }
+</style>
+<title>Style test</title>
+<div id=x>Fail</div>
+<div id=y style="color: red; display: inline">test</div>
+<script src=asserts.js></script>
+<script>
+const y = document.getElementById("y");
+assertEquals(y.style.cssText, "color: red; display: inline;");
+assertEquals(window.getComputedStyle(y).cssText, "");
+assertEquals(window.getComputedStyle(y, "::before").color, "rgb(255, 0, 0)");
+y.remove();
+document.getElementById("x").textContent = "Success";
+</script>