From a9a25d4ecaec19fc94535a1f1cce247fae3a83de Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 4 Nov 2024 16:13:35 +0000 Subject: [PATCH] Tests: Add a test for `@supports` This is derived from our old demo page. Notably, we currently do claim to support `::-webkit-foo` selectors, which is a bug. According to the spec [1], we have to parse those as valid, but `@supports` should still fail for them [2], which is a bit confusing. [1] https://www.w3.org/TR/selectors-4/#compat [2] https://drafts.csswg.org/css-conditional-4/#support-definition-ext --- Tests/LibWeb/Text/expected/css/supports.txt | 17 ++++++++ Tests/LibWeb/Text/input/css/supports.html | 47 +++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 Tests/LibWeb/Text/expected/css/supports.txt create mode 100644 Tests/LibWeb/Text/input/css/supports.html diff --git a/Tests/LibWeb/Text/expected/css/supports.txt b/Tests/LibWeb/Text/expected/css/supports.txt new file mode 100644 index 00000000000..a42e2dbfee7 --- /dev/null +++ b/Tests/LibWeb/Text/expected/css/supports.txt @@ -0,0 +1,17 @@ +These should all pass: +@supports (color: green): PASS +@supports (color: green) and (width: 50px): PASS +@supports (color: green) or (flogwizzle: purple): PASS +@supports (not (flogwizzle: purple)): PASS +@supports selector(.simple): PASS +@supports selector(a#more > .complicated.case:nth-child(42)): PASS +@supports selector(.easy) or selector(.....nope): PASS + +These should all fail: +@supports (not (color: green)): FAIL +@supports (color: green) and (width: 50px) or (color: green): FAIL +@supports (width: yellow) or (height: green): FAIL +@supports (flogwizzle: purple): FAIL +@supports selector(.....nope): FAIL +@supports selector(::-webkit-input-placeholder): PASS +@supports selector(32) or selector(thing[foo??????bar]): FAIL diff --git a/Tests/LibWeb/Text/input/css/supports.html b/Tests/LibWeb/Text/input/css/supports.html new file mode 100644 index 00000000000..c39dc01b14c --- /dev/null +++ b/Tests/LibWeb/Text/input/css/supports.html @@ -0,0 +1,47 @@ + + + + +
+