Skip to content

Commit b9751c8

Browse files
Steinar H. Gundersonmoz-wptsync-bot
Steinar H. Gunderson
authored andcommitted
Bug 1928335 [wpt PR 48907] - Implement at-rule for use with @supports., a=testonly
Automatic update from web-platform-tests Implement at-rule for use with @supports. It's behind a flag for now. Note that there is a CSSWG resolution (w3c/csswg-drafts#2463 (comment)) but no spec. We don't support the proposed but not yet ratified extension of having a full block (w3c/csswg-drafts#6966) Bug: 40211832 Change-Id: Ic80e28abe9e9fce6d44b1a52311aba7b60a8caa2 Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/5972643 Reviewed-by: Anders Hartvoll Ruud <[email protected]> Commit-Queue: Steinar H Gunderson <[email protected]> Cr-Commit-Position: refs/heads/main@{#1376258} -- wpt-commits: 30d1140df3e85670983adf8de61ed07fdca9cdbb wpt-pr: 48907
1 parent 708904b commit b9751c8

File tree

1 file changed

+37
-0
lines changed

1 file changed

+37
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<!doctype html>
2+
<title>@supports at-rule</title>
3+
<link rel="help" href="https://www.w3.org/TR/css-conditional-4/#the-css-namespace">
4+
<script src="/resources/testharness.js"></script>
5+
<script src="/resources/testharnessreport.js"></script>
6+
<script>
7+
function test_supports(rule, expected, desc) {
8+
test(() => {
9+
assert_equals(CSS.supports(rule), expected, 'CSS.supports(' + rule + ')');
10+
}, desc);
11+
}
12+
13+
// Basic at-rule support.
14+
test_supports("at-rule(@supports)", true);
15+
test_supports("at-rule( @supports)", true);
16+
test_supports("at-rule(@supports )", true);
17+
test_supports("at-rule(@media)", true);
18+
test_supports("at-rule(@counter-style)", true);
19+
test_supports("at-rule(@doesnotexist)", false);
20+
21+
// With descriptors.
22+
test_supports("at-rule(@counter-style; system: fixed)", true);
23+
test_supports("at-rule(@counter-style;system: fixed )", true);
24+
test_supports("at-rule(@counter-style;system: fixed )", true);
25+
test_supports("at-rule(@counter-style; system:)", false, "missing value 1");
26+
test_supports("at-rule(@counter-style; system: )", false, "missing value 2");
27+
test_supports("at-rule(@counter-style; system: doesnotexist)", false, "invalid value");
28+
test_supports("at-rule(@counter-style; system: fixed junk)", false, "junk after value");
29+
test_supports("at-rule(@counter-style; system)", false, "missing value 3");
30+
test_supports("at-rule(@counter-style! system: fixed)", false, "invalid separator");
31+
test_supports("at-rule(@counter-style; suffix: \"abc\")", true, "quoted value is OK");
32+
test_supports("at-rule(@counter-style; suffix: \"abc\";)", false, "semicolon after value");
33+
test_supports("at-rule(@counter-style; suffix: \"abc\"", true, "implicit end parenthesis");
34+
test_supports("at-rule(@counter-style; system: fixed; system: fixed)", false, "multiple descriptors");
35+
test_supports("at-rule(@supports; system: fixed)", false, "descriptor invalid in context");
36+
test_supports("at-rule(@media; color: red)", false, "properties are not descriptors");
37+
</script>

0 commit comments

Comments
 (0)