Tests: Synchronize imported tests with the WPT repository

This commit is contained in:
Tim Ledbetter
2025-06-21 15:43:33 +01:00
committed by Alexander Kalenik
parent 11e5cd5048
commit 689dff3ee8
Notes: github-actions[bot] 2025-06-22 21:52:43 +00:00
155 changed files with 1485 additions and 750 deletions

View File

@@ -7,9 +7,17 @@
<script src="../../../resources/testharness.js"></script>
<script src="../../../resources/testharnessreport.js"></script>
<script src="../../../css/support/computed-testcommon.js"></script>
<style>
#container {
container-type: inline-size;
width: 100px;
}
</style>
</head>
<body>
<div id="target"></div>
<div id="container">
<div id="target"></div>
</div>
<script>
// auto
test_computed_value("grid-area", "auto / auto / auto / auto",
@@ -34,6 +42,9 @@ test_computed_value("grid-row-start", "9 -Z_");
test_computed_value("grid-column-start", "-44 Z");
test_computed_value("grid-row-end", "1 -πA");
test_computed_value("grid-column-end", "5 π_");
test_computed_value("grid-row-start", "calc(1.1) -a-", "1 -a-");
test_computed_value("grid-row-start", "calc(10) -a-", "10 -a-");
test_computed_value("grid-row-start", "calc(10 + (sign(2cqw - 10px) * 5)) -a-", "5 -a-");
// span && [ <integer> || <custom-ident> ]
test_computed_value("grid-area", "span 2 i / auto / auto / auto",

View File

@@ -268,7 +268,6 @@ setup({ explicit_done: true });
document.fonts.ready.then(() => {
testGridDefinitionsValues("gridWithFixedElement", "7px 11px", "17px 2px");
testGridDefinitionsValues("gridWithPercentElement", "400px 800px", "150px 450px");
// This test failing in Firefox is caused by https://bugzilla.mozilla.org/show_bug.cgi?id=1481876
testGridDefinitionsValues("gridWithPercentWithoutSize", "3.5px 7px", "4px 12px");
testGridDefinitionsValues("gridWithAutoElement", "0px 17px", "0px 3px");
testGridDefinitionsValues("gridWithEMElement", "100px 120px", "150px 170px");

View File

@@ -2,7 +2,7 @@
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: only serialize 'grid' when the value can roundtrip</title>
<title>CSS Grid Layout Test: only serialize 'grid' shorthands when the value can roundtrip</title>
<link rel="author" title="Daniel Libby" href="mailto:dlibby@microsoft.com">
<link rel="author" title="Kurt Catti-Schmidt" href="mailto:kschmi@microsoft.com">
<link rel="help" href="https://drafts.csswg.org/css-grid/#propdef-grid">
@@ -236,6 +236,41 @@
'grid-template-columns': 'none',
'grid-template-rows': 'repeat(auto-fit, 3px)'
});
test_shorthand_roundtrip('grid-template: none;',
{
'grid': '',
'grid-template-areas': 'none',
'grid-template-rows': 'none',
'grid-template-columns': 'none',
'grid-template': 'none'
});
test_shorthand_roundtrip('grid-template: auto / auto;',
{
'grid': '',
'grid-template-areas': 'none',
'grid-template-rows': 'auto',
'grid-template-columns': 'auto',
'grid-template': 'auto / auto'
});
test_shorthand_roundtrip('grid-template: [header-top] "a a a" [header-bottom] [main-top] "b b b" 1fr [main-bottom] / auto 1fr auto',
{
'grid': '',
'grid-template-areas': '"a a a" "b b b"',
'grid-template-rows': '[header-top] auto [header-bottom main-top] 1fr [main-bottom]',
'grid-template-columns': 'auto 1fr auto',
'grid-template': '[header-top] "a a a" [header-bottom main-top] "b b b" 1fr [main-bottom] / auto 1fr auto'
});
test_shorthand_roundtrip('grid-template: [header-top] "a a a" [header-bottom] [main-top] "b b b" 1fr [main-bottom] "c c c" "d d d" / auto',
{
'grid': '',
'grid-template-areas': '"a a a" "b b b" "c c c" "d d d"',
'grid-template-rows': '[header-top] auto [header-bottom main-top] 1fr [main-bottom] auto auto',
'grid-template-columns': 'auto',
'grid-template': '[header-top] "a a a" [header-bottom main-top] "b b b" 1fr [main-bottom] "c c c" "d d d" / auto'
});
test_shorthand_roundtrip('grid-template-rows: auto auto; grid-template-columns: repeat(2, 3px); grid-template-areas: "one two" "three four"',
{
'grid': '',

View File

@@ -28,6 +28,7 @@ function testValidGridTemplate(valueGridTemplate, valueGridAreas, serializedGrid
testValidGridTemplate("none / 1px", "\"a\"", "");
testValidGridTemplate("none / none", "\"a\"", "");
testValidGridTemplate("none / none", "\"a\" \"b\" \"c\" \"d\" \"e\"", "");
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",

View File

@@ -58,6 +58,15 @@ test_shorthand_value('grid-template',
'grid-template-columns': 'auto 1fr auto',
'grid-template-areas': '"a a a" "b b b"'
});
test_shorthand_value('grid-template',
' [] "a a a" []' +
' [] "b b b" 1fr []' +
' "c c c" / [] auto 1fr [] auto []', {
'grid-template-rows': 'auto 1fr auto',
'grid-template-columns': 'auto 1fr auto',
'grid-template-areas': '"a a a" "b b b" "c c c"'
});
</script>
</body>
</html>