Skip to content

Commit 53403b0

Browse files
Ana SollanoKimchromium-wpt-export-bot
Ana SollanoKim
authored andcommittedJan 18, 2022
Fixing a crash and adding grid-template and grid-template-areas tests
This CL handles the case where an element has 'grid-template' or 'grid' and 'grid-template-areas' definitions. Additional tests were added since the existing WPTs related to parsing only validate the serialization of individual properties. Bug: 1287573 Change-Id: I58ae82a7cb05559d52b006b24e68b8faa6d58fbf Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/3390628 Reviewed-by: Daniel Libby <[email protected]> Reviewed-by: Rune Lillesveen <[email protected]> Commit-Queue: Ana Sollano Kim <[email protected]> Cr-Commit-Position: refs/heads/main@{#960604}
1 parent 2f7da96 commit 53403b0

File tree

1 file changed

+35
-0
lines changed

1 file changed

+35
-0
lines changed
 
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
<!DOCTYPE html>
2+
<html>
3+
<head>
4+
<meta charset="utf-8">
5+
<title>CSS Grid Layout Test: grid-template and grid-template-areas</title>
6+
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template">
7+
<meta name=assert content="grid-template and grid-template-areas parsing is valid.">
8+
<script src="/resources/testharness.js"></script>
9+
<script src="/resources/testharnessreport.js"></script>
10+
</head>
11+
<body>
12+
<script>
13+
14+
function testValidGridTemplate(valueGridTemplate, valueGridAreas, serializedGridTemplateValue) {
15+
if (arguments.length < 3)
16+
serializedGridTemplateValue = valueGridTemplate;
17+
18+
test(()=>{
19+
const root = document.children[0];
20+
root.style.gridTemplate = "";
21+
root.style.gridTemplate = valueGridTemplate;
22+
root.style.gridTemplateAreas = "";
23+
root.style.gridTemplateAreas = valueGridAreas;
24+
assert_equals(root.style.gridTemplate, serializedGridTemplateValue);
25+
assert_equals(root.style.gridTemplateAreas, valueGridAreas);
26+
}, `grid-template: ${valueGridTemplate} and "grid-template-areas: ${valueGridAreas};" should be valid.`);
27+
}
28+
29+
testValidGridTemplate("none / 1px", "\"a\"");
30+
testValidGridTemplate("none / none", "\"a\"", "none");
31+
testValidGridTemplate("auto / 1px", "\"a a a\"", "\"a a a\" / 1px");
32+
testValidGridTemplate("auto / auto", "\"a a a\"", "\"a a a\" / auto");
33+
</script>
34+
</body>
35+
</html>

0 commit comments

Comments
 (0)