Skip to content

Commit f74c10d

Browse files
authored
1 parent fa5393b commit f74c10d

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
<!DOCTYPE html>
2+
<meta charset="utf-8">
3+
<title>CSS Grid Layout Test: 'grid-template-columns' and 'grid-template-rows' resolved values are the used track sizes</title>
4+
<link rel="help" href="https://drafts.csswg.org/css-grid-2/#resolved-track-list">
5+
<meta name="assert" content="The resolved value of grid-template-columns and grid-template-rows for a grid container is the used value, with each track serialized as a length in pixels, including for grids with explicitly placed items and fixed-length gaps.">
6+
<script src="/resources/testharness.js"></script>
7+
<script src="/resources/testharnessreport.js"></script>
8+
<style>
9+
.grid {
10+
display: grid;
11+
grid-template-columns: 100px 200px 300px;
12+
grid-template-rows: 40px 60px;
13+
}
14+
.withGaps {
15+
gap: 10px 20px;
16+
}
17+
.a { grid-row: 1 / 2; grid-column: 1 / 2; }
18+
.b { grid-row: 2 / 3; grid-column: 1 / 2; }
19+
</style>
20+
<div id="log"></div>
21+
22+
<div class="grid" id="grid"><div class="a"></div><div class="b"></div></div>
23+
<div class="grid withGaps" id="gridWithGaps"><div class="a"></div><div class="b"></div></div>
24+
25+
<script>
26+
test(() => {
27+
assert_equals(getComputedStyle(document.getElementById("grid")).gridTemplateColumns, "100px 200px 300px");
28+
}, "Resolved grid-template-columns is the used track sizes");
29+
30+
test(() => {
31+
assert_equals(getComputedStyle(document.getElementById("grid")).gridTemplateRows, "40px 60px");
32+
}, "Resolved grid-template-rows is the used track sizes");
33+
34+
test(() => {
35+
assert_equals(getComputedStyle(document.getElementById("gridWithGaps")).gridTemplateColumns, "100px 200px 300px");
36+
}, "Resolved grid-template-columns is the used track sizes with fixed-length gaps");
37+
38+
test(() => {
39+
assert_equals(getComputedStyle(document.getElementById("gridWithGaps")).gridTemplateRows, "40px 60px");
40+
}, "Resolved grid-template-rows is the used track sizes with fixed-length gaps");
41+
</script>

0 commit comments

Comments
 (0)