Skip to content

Truly independent web browser

LibWeb: Import CSSOM functional pseudo-element coverage

Andreas Kling1caab6a089b6
diff --git a/Tests/LibWeb/Text/expected/wpt-import/css/cssom/getComputedStyle-pseudo-with-argument.txt b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/getComputedStyle-pseudo-with-argument.txt
new file mode 100644
index 00000000000..b36a9437b56
--- /dev/null
+++ b/Tests/LibWeb/Text/expected/wpt-import/css/cssom/getComputedStyle-pseudo-with-argument.txt
@@ -0,0 +1,29 @@
+Harness status: OK
+
+Found 22 tests
+
+13 Pass
+9 Fail
+Pass This pseudo-element should not parse: ::before(test)
+Pass This pseudo-element should not parse: ::highlight
+Pass This pseudo-element should not parse: ::highlight(
+Pass This pseudo-element should not parse: ::highlight()
+Pass This pseudo-element should not parse: ::highlight(1)
+Pass This pseudo-element should not parse: ::highlight($)
+Pass This pseudo-element should not parse: ::highlight (name)
+Pass This pseudo-element should not parse: ::highlight(name)a
+Pass This pseudo-element should not parse: :highlight(name)
+Fail This pseudo-element should not parse: ::view-transition-group(*)
+Fail This pseudo-element should not parse: ::view-transition-image-pair(*)
+Fail This pseudo-element should not parse: ::view-transition-old(*)
+Fail This pseudo-element should not parse: ::view-transition-new(*)
+Pass This pseudo-element should not parse: :view-transition-group(name)
+Pass This pseudo-element should not parse: :view-transition-image-pair(name)
+Pass This pseudo-element should not parse: :view-transition-old(name)
+Pass This pseudo-element should not parse: :view-transition-new(name)
+Fail This pseudo-element should parse: ::highlight(name)
+Fail This pseudo-element should parse: ::highlight(
+name
+Fail This pseudo-element should parse: ::highlight(name
+Fail This pseudo-element should parse: ::highlight( name
+Fail This pseudo-element should parse: ::highlight( n\61me )
\ No newline at end of file
diff --git a/Tests/LibWeb/Text/input/wpt-import/css/cssom/getComputedStyle-pseudo-with-argument.html b/Tests/LibWeb/Text/input/wpt-import/css/cssom/getComputedStyle-pseudo-with-argument.html
new file mode 100644
index 00000000000..69e5fce98a9
--- /dev/null
+++ b/Tests/LibWeb/Text/input/wpt-import/css/cssom/getComputedStyle-pseudo-with-argument.html
@@ -0,0 +1,64 @@
+<!doctype html>
+<meta charset="utf-8">
+<title>CSSOM: Handling pseudo-elements with arguments</title>
+<script src=../../resources/testharness.js></script>
+<script src=../../resources/testharnessreport.js></script>
+<link rel=help href=https://drafts.csswg.org/cssom/#dom-window-getcomputedstyle>
+<style>
+#pseudo-invalid::highlight(name) {
+ color: rgb(0, 128, 0);
+}
+#pseudo-invalid::view-transition-image-pair(name) {
+ color: rgb(0, 128, 0);
+}
+#pseudo-invalid::view-transition-group(name) {
+ color: rgb(0, 128, 0);
+}
+#pseudo-invalid::view-transition-old(name) {
+ color: rgb(0, 128, 0);
+}
+#pseudo-invalid::view-transition-new(name) {
+ color: rgb(0, 128, 0);
+}
+</style>
+<ul><li id="pseudo-invalid">Item</li></ul>
+<script>
+[
+ "::before(test)",
+ "::highlight",
+ "::highlight(",
+ "::highlight()",
+ "::highlight(1)",
+ "::highlight($)",
+ "::highlight (name)",
+ "::highlight(name)a",
+ ":highlight(name)",
+ "::view-transition-group(*)",
+ "::view-transition-image-pair(*)",
+ "::view-transition-old(*)",
+ "::view-transition-new(*)",
+ ":view-transition-group(name)",
+ ":view-transition-image-pair(name)",
+ ":view-transition-old(name)",
+ ":view-transition-new(name)",
+].forEach(nonParsablePseudoIdentifier => {
+ test(() => {
+ const li = document.querySelector('li');
+ assert_equals(getComputedStyle(li, nonParsablePseudoIdentifier).length, 0);
+ }, `This pseudo-element should not parse: ${nonParsablePseudoIdentifier}`)
+});
+
+[
+ "::highlight(name)",
+ "::highlight(\nname",
+ "::highlight(name\t",
+ "::highlight( name ",
+ "::highlight( n\\61me )"
+].forEach(parsablePseudoIdentifier => {
+ test(() => {
+ const li = document.querySelector('li');
+ assert_true(getComputedStyle(li, parsablePseudoIdentifier).length != 0);
+ assert_equals(getComputedStyle(li, parsablePseudoIdentifier).color, "rgb(0, 128, 0)");
+ }, `This pseudo-element should parse: ${parsablePseudoIdentifier}`);
+});
+</script>