Update web-platform-tests to revision b'b728032f59a396243864b0f8584e7211e3632005'

This commit is contained in:
WPT Sync Bot 2022-11-10 01:22:36 +00:00
parent ace9b32b1c
commit df68c4e5d1
15632 changed files with 514865 additions and 155000 deletions

View file

@ -196,12 +196,6 @@
assert_equals(rules[0].cssRules[0].type, CSSRule.FONT_FACE_RULE);
}, "Inserting @font-face inside @supports works");
test(function(){
var style_rule = document.styleSheets[0].cssRules[0].cssRules[1];
assert_throws_js(TypeError, function() { style_rule.insertRule("@supports (width: 0) { ol { width: 0; } }", 0);} );
}, "Inserting an @supports inside a style rule should fail");
test(function(){
var rule = document.styleSheets[0].cssRules[1];
assert_equals_normalized(rule.cssText,

View file

@ -5,6 +5,10 @@
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(CSS.supports("(color: red)"), true);
}, "Single-argument form allows for declarations with enclosing parentheses");
test(function() {
assert_equals(CSS.supports("color: red"), true);
}, "Single-argument form allows for declarations without enclosing parentheses");
@ -26,17 +30,50 @@
}, "Variable references in an unknown function always parse");
test(function() {
// no one-arg test for this as the with/without enclosing parentheses tests do this
assert_equals(CSS.supports("color", "red"), true);
}, "two argument form succeeds for known property");
test(function() {
assert_equals(CSS.supports("unknownproperty: blah"), false);
}, "one argument form fails for unknown property");
test(function() {
assert_equals(CSS.supports("unknownproperty", "blah"), false);
}, "two argument form fails for unknown property");
test(function() {
// https://github.com/w3c/csswg-drafts/issues/5929
assert_equals(CSS.supports("unicode-range: U+0-7F"), false);
}, "one argument form fails for unknown property (but known descriptor)");
test(function() {
// https://github.com/w3c/csswg-drafts/issues/5929
assert_equals(CSS.supports("unicode-range", "U+0-7F"), false);
}, "two argument form fails for unknown property (but known descriptor)");
test(function() {
// https://github.com/w3c/csswg-drafts/issues/5929
assert_equals(CSS.supports("unicode-range: inherit"), false);
}, "one argument form fails for unknown property (but known descriptor, universal value)");
test(function() {
// https://github.com/w3c/csswg-drafts/issues/5929
assert_equals(CSS.supports("unicode-range", "inherit"), false);
}, "two argument form fails for unknown property (but known descriptor, universal value)");
test(function() {
assert_equals(CSS.supports("width: blah"), false);
}, "one argument form fails for invalid value");
test(function() {
assert_equals(CSS.supports("width", "blah"), false);
}, "two argument form fails for invalid value");
test(function() {
assert_equals(CSS.supports("--foo: blah"), true);
}, "one argument form succeeds for custom property");
test(function() {
assert_equals(CSS.supports("--foo", "blah"), true);
}, "two argument form succeeds for custom property");

View file

@ -28,4 +28,28 @@
test(function() {
assert_equals(CSS.supports("selector(div | .c)"), false);
}, "selector() with unknown combinators");
test(function() {
assert_equals(CSS.supports("selector(:is(:foo))"), false);
}, "selector() with forgiving :is, 1 arg");
test(function() {
assert_equals(CSS.supports("selector(:is(:foo, div))"), false);
}, "selector() with forgiving :is, multiple args");
test(function() {
assert_equals(CSS.supports("selector(:where(:foo))"), false);
}, "selector() with forgiving :where, 1 arg");
test(function() {
assert_equals(CSS.supports("selector(:where(:foo, div))"), false);
}, "selector() with forgiving :where, multiple args");
test(function() {
assert_equals(CSS.supports("selector(:has(:foo))"), false);
}, "selector() with forgiving :has, 1 arg");
test(function() {
assert_equals(CSS.supports("selector(:has(:foo, div))"), false);
}, "selector() with forgiving :has, multiple args");
</script>

View file

@ -0,0 +1,43 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS.supports() Level 5</title>
<link rel="help" href="https://drafts.csswg.org/css-conditional-5/#at-supports-ext">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(CSS.supports("font-format(opentype)"), true);
}, "font-format() function accepts a known format");
test(function() {
assert_equals(CSS.supports("font-format(xyzzy)"), false);
}, "font-format() function doesn't accept an unknown format");
test(function() {
assert_equals(CSS.supports("font-format(opentype, truetype)"), false);
}, "font-format() function doesn't accept a format list");
test(function() {
assert_equals(CSS.supports("font-format('opentype')"), false);
}, "font-format() function doesn't accept a string.");
test(function() {
assert_equals(CSS.supports("font-tech(features-opentype)"), true);
}, "font-tech() function accepts a known technology");
test(function() {
assert_equals(CSS.supports("font-tech(feature-opentype)"), false);
}, "font-tech() function doesn't accept singular feature-* form for technology");
test(function() {
assert_equals(CSS.supports("font-tech(foobar)"), false);
}, "font-tech() function doesn't accept an unknown technology");
test(function() {
assert_equals(CSS.supports("font-tech(features-opentype, color-COLRv0)"), false);
}, "font-tech() function doesn't accept a technology list");
test(function() {
assert_equals(CSS.supports("font-tech('features-opentype')"), false);
}, "font-tech() function doesn't accept a string.");
</script>

View file

@ -0,0 +1,52 @@
<!doctype html>
<meta charset="utf-8">
<title>CSS.supports() detecting invalid in forgiving argument</title>
<link rel="help" href="https://www.w3.org/TR/css-conditional-4/#the-css-namespace">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script>
test(function() {
assert_equals(CSS.supports("selector(:is(:foo))"), false);
assert_equals(CSS.supports("selector(:is(.a, :foo))"), false);
assert_equals(CSS.supports("selector(:is(:foo, .a))"), false);
assert_equals(CSS.supports("selector(:is(:has(:foo, a), .b))"), false);
assert_equals(CSS.supports("selector(:where(:foo))"), false);
assert_equals(CSS.supports("selector(:where(.a, :foo))"), false);
assert_equals(CSS.supports("selector(:where(:foo, .a))"), false);
assert_equals(CSS.supports("selector(:where(:is(:foo, a), .b))"), false);
assert_equals(CSS.supports("selector(:has(:foo))"), false);
assert_equals(CSS.supports("selector(:has(.a, :foo))"), false);
assert_equals(CSS.supports("selector(:has(:foo, .a))"), false);
assert_equals(CSS.supports("selector(:has(:where(:foo, a), .b))"), false);
}, "Invalid selector can be detected with CSS.supports() even if it is dropped by forgiving parsing");
test(function() {
assert_equals(CSS.supports("selector(:is())"), false);
assert_equals(CSS.supports("selector(:where())"), false);
assert_equals(CSS.supports("selector(:has())"), false);
}, ":is(), :where() or :has() always fails without argument");
test(function() {
assert_equals(CSS.supports("selector(:has(:has(.a)))"), false);
assert_equals(CSS.supports("selector(:has(:has(.a), b))"), false);
assert_equals(CSS.supports("selector(.a, :has(:has(.b)))"), false);
assert_equals(CSS.supports("selector(:has(:is(:has(.a))))"), false);
assert_equals(CSS.supports("selector(:has(:is(:has(.a), .b)))"), false);
assert_equals(CSS.supports("selector(:has(:is(.a, :has(.b))))"), false);
}, ":has() always fails inside :has()");
test(function() {
assert_equals(CSS.supports("selector(:is(::after)"), false);
assert_equals(CSS.supports("selector(:is(::before)"), false);
assert_equals(CSS.supports("selector(:is(::first-letter)"), false);
assert_equals(CSS.supports("selector(:is(::first-line)"), false);
assert_equals(CSS.supports("selector(:where(::after)"), false);
assert_equals(CSS.supports("selector(:where(::before)"), false);
assert_equals(CSS.supports("selector(:where(::first-letter)"), false);
assert_equals(CSS.supports("selector(:where(::first-line)"), false);
assert_equals(CSS.supports("selector(:has(::after)"), false);
assert_equals(CSS.supports("selector(:has(::before)"), false);
assert_equals(CSS.supports("selector(:has(::first-letter)"), false);
assert_equals(CSS.supports("selector(:has(::first-line)"), false);
}, "Some pseudo elements always fail inside :is(), :where(), :has()");
</script>

View file

@ -0,0 +1,41 @@
<!DOCTYPE HTML>
<meta charset=UTF-8>
<title>CSSGroupingRule Conditional Rules Test</title>
<link rel="author" title="L. David Baron" href="https://dbaron.org/">
<link rel="help" href="https://www.w3.org/TR/css-conditional-3/#the-cssconditionrule-interface">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<style id="style"></style>
<script>
function check_condition_text(text) {
test(function() {
let style_element = document.getElementById("style");
style_element.textContent = `@supports ${text} {}`;
let rules = style_element.sheet.cssRules;
assert_equals(rules.length, 1);
assert_equals(rules[0].conditionText, text);
}, `conditionText getter for @supports ${text}`);
}
check_condition_text("(color: red)");
check_condition_text("(color : red) or ( color:blue )");
check_condition_text("not (color: red)");
check_condition_text("()");
check_condition_text("func()");
check_condition_text("([])");
check_condition_text("({})");
check_condition_text("(())");
check_condition_text("(func())");
check_condition_text("(x)");
check_condition_text("func(x)");
check_condition_text("([x])");
check_condition_text("({x})");
check_condition_text("((x))");
check_condition_text("(func(x))");
</script>
</body>
</html>