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

@ -39,7 +39,7 @@ test_computed_value("grid-column-end", "5 π_");
test_computed_value("grid-area", "span 2 i / auto / auto / auto",
["span 2 i", "span 2 i / auto / auto / auto"]);
test_computed_value("grid-row", "span 2 / auto", ["span 2", "span 2 / auto"]);
test_computed_value("grid-column-start", "span 1 i");
test_computed_value("grid-column-start", "span 1 i", "span i");
test_computed_value("grid-row-end", "span 2 i");
test_computed_value("grid-column-end", "span 2");

View file

@ -46,6 +46,7 @@ test_invalid_value("grid", 'auto-flow 100px');
test_invalid_value("grid", 'auto-flow / auto-flow');
test_invalid_value("grid", 'auto-flow 1fr / auto-flow 1fr');
test_invalid_value("grid", 'dense auto-flow / dense auto-flow');
test_invalid_value("grid", 'auto / auto-flow foo()');
// FIXME: add more values to test full syntax
</script>

View file

@ -0,0 +1,124 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: only serialize 'grid' when the value can roundtrip</title>
<link rel="author" title="Daniel Libby" href="mailto:dlibby@microsoft.com">
<link rel="help" href="https://drafts.csswg.org/css-grid/#propdef-grid">
<meta name="assert" content="grid shorthand must not serialize when the value cannot roundtrip.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>
function test_shorthand_roundtrip(cssText, properties, declarations) {
var div = document.createElement('div');
div.style.cssText = cssText;
for (let property of Object.keys(properties).sort()) {
test(function(){
const readValue = div.style[property];
if (Array.isArray(properties[property])) {
assert_in_array(readValue, properties[property], property + " serialization should be sound");
} else {
assert_equals(readValue, properties[property], property + " serialization should be canonical");
}
if (readValue != "") {
div.style[property] = "";
div.style[property] = readValue;
assert_equals(div.style[property], readValue, "serialization should round-trip");
}
}, "e.style.cssText = " + cssText + " should set " + property);
}
if (declarations) {
let cssText = div.style.cssText;
declarations.forEach(decl => {
test(function(){
assert_true(cssText.indexOf(decl) !== -1, `cssText ('${cssText}') must contain '${decl}'`);
}, `cssText ('${cssText}') must contain '${decl}'`);
});
}
}
test_shorthand_roundtrip('grid: auto-flow auto / 100px 100px',
{
'grid': ['auto-flow / 100px 100px', 'none / 100px 100px'],
'grid-template-areas': 'none'
});
test_shorthand_roundtrip('grid: auto-flow auto / 100px 100px; grid-template-areas: "one two" "three four"',
{
'grid': '',
'grid-template-areas': '"one two" "three four"',
'grid-auto-flow': 'row',
'grid-auto-rows': 'auto'
});
test_shorthand_roundtrip('grid: 30px 40px / 50px 60px; grid-auto-flow: column',
{
'grid': '',
'grid-template': '30px 40px / 50px 60px',
'grid-auto-flow': 'column',
}, [
'grid-template: 30px 40px / 50px 60px;',
'grid-auto-rows: auto;',
'grid-auto-columns: auto;',
'grid-auto-flow: column;'
]);
test_shorthand_roundtrip('grid: auto-flow / 10px; grid-template-rows: 20px',
{
'grid': '20px / 10px',
'grid-template': '20px / 10px'
}, [
'grid: 20px / 10px;'
]);
test_shorthand_roundtrip('grid: auto-flow 1px / 2px; grid-auto-flow: inherit', { 'grid': '' });
test_shorthand_roundtrip('grid: 1px / 2px; grid-auto-flow: row', { 'grid': '1px / 2px' });
test_shorthand_roundtrip('grid: 1px / 2px; grid-auto-columns: auto', { 'grid': '1px / 2px' });
test_shorthand_roundtrip('grid: 1px / 2px; grid-auto-rows: auto', { 'grid': '1px / 2px' });
test_shorthand_roundtrip('grid: 1px / auto-flow 2px; grid-auto-rows: auto', { 'grid': '1px / auto-flow 2px' });
test_shorthand_roundtrip('grid: 1px / auto-flow; grid-auto-columns: auto', { 'grid': '1px / auto-flow' });
test_shorthand_roundtrip('grid: auto-flow 1px / 2px; grid-auto-columns: auto', { 'grid': 'auto-flow 1px / 2px' });
test_shorthand_roundtrip('grid: auto-flow dense / 2px; grid-auto-rows: auto', { 'grid': 'auto-flow dense / 2px' });
test_shorthand_roundtrip('grid: auto-flow 1px / 2px; grid-auto-columns: 3px',
{
'grid': '',
'grid-auto-columns': '3px',
'grid-auto-rows': '1px',
'grid-auto-flow': 'row',
'grid-template-columns': '2px',
'grid-template-rows': 'none'
});
test_shorthand_roundtrip('grid: 1px / auto-flow 2px; grid-auto-rows: 3px',
{
'grid': '',
'grid-auto-columns': '2px',
'grid-auto-rows': '3px',
'grid-auto-flow': 'column',
'grid-template-columns': 'none',
'grid-template-rows': '1px'
});
test_shorthand_roundtrip('grid: none / auto-flow 1px; grid-template-columns: 3px',
{
'grid': '',
'grid-auto-columns': '1px',
'grid-auto-rows': 'auto',
'grid-auto-flow': 'column',
'grid-template-columns': '3px',
'grid-template-rows': 'none'
});
test_shorthand_roundtrip('grid: auto-flow 1px / none; grid-template-rows: 3px',
{
'grid': '',
'grid-auto-columns': 'auto',
'grid-auto-rows': '1px',
'grid-auto-flow': 'row',
'grid-template-columns': 'none',
'grid-template-rows': '3px'
});
</script>

View file

@ -32,6 +32,19 @@ test_shorthand_value('grid', '10px / 20%', {
'grid-auto-flow': 'row'
});
// This could theoretically be serialized as "auto-flow / 10px",
// but spec mandates the 'grid-template-*' form when the
// 'grid-auto-*' properties are all initial.
test_shorthand_value('grid', 'none / 10px', {
'grid-template-rows': 'none',
'grid-template-columns': '10px',
'grid-template-areas': 'none',
'grid-auto-rows': 'auto',
'grid-auto-columns': 'auto',
'grid-auto-flow': 'row'
});
test_shorthand_value('grid', 'fit-content(calc(-0.5em + 10px)) / fit-content(calc(0.5em + 10px))', {
'grid-template-rows': 'fit-content(calc(-0.5em + 10px))',
'grid-template-columns': 'fit-content(calc(0.5em + 10px))',

View file

@ -30,6 +30,9 @@ testValidGridTemplate("none / 1px", "\"a\"");
testValidGridTemplate("none / none", "\"a\"", "none");
testValidGridTemplate("auto / 1px", "\"a a a\"", "\"a a a\" / 1px");
testValidGridTemplate("auto / auto", "\"a a a\"", "\"a a a\" / auto");
testValidGridTemplate("10px 20px 30px / 40px 50px 60px 70px",
"\"a . b .\" \"c d . e\" \"f g h .\"",
"\"a . b .\" 10px \"c d . e\" 20px \"f g h .\" 30px / 40px 50px 60px 70px");
</script>
</body>
</html>

View file

@ -51,6 +51,7 @@ test_valid_value("grid-template", '[a] "a" [a] "b" [a]');
test_valid_value("grid-template", '"a" "a" [a] "b" [a]');
test_valid_value("grid-template", '"a" [a] "b" [a] / 0', '"a" [a] "b" [a] / 0px');
test_valid_value("grid-template", '"a" "a" [a] [a] "b" / auto', '"a" "a" [a a] "b" / auto');
test_valid_value("grid-template", '"a" auto [a] "b" auto [b] / 10px');
// FIXME: add more values to test full syntax