Skip to content

Commit

Permalink
Bug 1750320 [wpt PR 32393] - Fixing a crash and adding grid-template …
Browse files Browse the repository at this point in the history
…and grid-template-areas tests, a=testonly

Automatic update from web-platform-tests
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}

--

wpt-commits: 53403b0e7ef8eff7387eebfff5bc5a74ee539de3
wpt-pr: 32393
  • Loading branch information
Ana SollanoKim authored and moz-wptsync-bot committed Feb 5, 2022
1 parent 7ffe40e commit 35eef79
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>CSS Grid Layout Test: grid-template and grid-template-areas</title>
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template">
<meta name=assert content="grid-template and grid-template-areas parsing is valid.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
</head>
<body>
<script>

function testValidGridTemplate(valueGridTemplate, valueGridAreas, serializedGridTemplateValue) {
if (arguments.length < 3)
serializedGridTemplateValue = valueGridTemplate;

test(()=>{
const root = document.children[0];
root.style.gridTemplate = "";
root.style.gridTemplate = valueGridTemplate;
root.style.gridTemplateAreas = "";
root.style.gridTemplateAreas = valueGridAreas;
assert_equals(root.style.gridTemplate, serializedGridTemplateValue);
assert_equals(root.style.gridTemplateAreas, valueGridAreas);
}, `grid-template: ${valueGridTemplate} and "grid-template-areas: ${valueGridAreas};" should be valid.`);
}

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");
</script>
</body>
</html>

0 comments on commit 35eef79

Please sign in to comment.