summaryrefslogtreecommitdiffstats
path: root/testing/web-platform/tests/css/css-grid/grid-definition/grid-auto-fit-rows-001.html
blob: 627a980c088fb4c9d0bbd94c0599b4d45de3ebda (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
<!DOCTYPE html>
<title>CSS Grid: auto-fit rows</title>
<link rel="author" title="Sergio Villar" href="mailto: svillar@igalia.com">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#valdef-repeat-auto-fit">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-columns">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-auto-rows">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-template-rows">
<link rel="help" href="https://drafts.csswg.org/css-grid-1/#propdef-grid-row">
<link rel="help" href="https://drafts.csswg.org/css-align-3/#propdef-grid-row-gap">
<link rel="help" href="https://crbug.com/619930">
<link rel="help" href="https://crbug.com/589460">
<meta name="assert" content="Check that auto-fit rows are properly computed in a grid container"/>
<link href="/css/support/grid.css" rel="stylesheet">
<style>

.grid {
    border: 2px solid magenta;
    height: 200px;
    width: 25px;
    align-content: start;
    grid-auto-rows: 157px;
    grid-auto-columns: 25px;

    float: left;
    position: relative;
    margin-right: 2px;
}

.gridOnlyAutoRepeat { grid-template-rows: repeat(auto-fit, 30px [autobar]); }
.gridPercentAutoRepeat { grid-template-rows: repeat(auto-fill, 30%); padding: 13px 0; }
.gridMinMaxAutoRepeat { grid-template-rows: repeat(auto-fill, minmax(13px, 30px)); }
.gridMaxMinAutoRepeat { grid-template-rows: repeat(auto-fill, minmax(30px, 13px)); }
.gridMaxMinPercentAutoRepeat { grid-template-rows: repeat(auto-fill, minmax(30px, 6.5%)); }
.gridAutoRepeatAndFixedBefore { grid-template-rows: 10px [foo] 20% [bar] repeat(auto-fit, [autofoo] 35px); }
.gridAutoRepeatAndFixedAfter { grid-template-rows: repeat(auto-fit, [first] 30px [last]) [foo] minmax(60px, 80px) [bar] minmax(45px, max-content); }
.gridAutoRepeatAndFixed { grid-template-rows: [start] repeat(2, 50px [a]) [middle] repeat(auto-fit, [autofoo] 15px [autobar]) minmax(5%, 10%) [end]; }
.gridMultipleNames { grid-template-rows: [start] 20px [foo] 50% repeat(auto-fit, [bar] 20px [start foo]) [foo] 10% [end bar]; }
.gridMultipleTracks { grid-template-rows: [start] 20px repeat(auto-fit, [a] 2em [b c] 10% [d]) [e] minmax(75px, 1fr) [last]; }

.item { background: cyan; }
.item:nth-child(2n) { background: green; }

.gap { grid-row-gap: 20px; }

</style>

<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/resources/check-layout-th.js"></script>

<body onload="checkLayout('.grid')">
<div id="log"></div>

<p>This test checks that repeat(auto-fit, ) syntax works as expected.</p>

<div class="grid gridOnlyAutoRepeat">
    <div class="item" style="grid-row: 1 / span 6" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
</div>

<div class="grid gridPercentAutoRepeat">
    <div class="item" style="grid-row: 1 / -1" data-offset-y="13" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
</div>

<div class="grid gridMinMaxAutoRepeat">
    <div class="item" style="grid-row: 1 / -1" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
</div>

<div class="grid gridMaxMinAutoRepeat">
    <div class="item" style="grid-row: 1 / -1" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
</div>

<div class="grid gridMaxMinPercentAutoRepeat">
    <div class="item" style="grid-row: 1 / -1" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
</div>

<div class="grid gridOnlyAutoRepeat">
    <div class="item" style="grid-row: 1 / span 6 autobar" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
</div>

<div class="grid gridOnlyAutoRepeat gap">
    <div class="item" style="grid-row: 1 / span 5" data-offset-y="0" data-offset-x="0" data-expected-height="357" data-expected-width="25"></div>
</div>

<div class="grid gridOnlyAutoRepeat gap">
    <div class="item" style="grid-row: autobar 2 / span 3" data-offset-y="0" data-offset-x="0" data-expected-height="257" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedBefore">
    <div class="item" style="grid-row: 1 / span 6" data-offset-y="0" data-offset-x="0" data-expected-height="190" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedBefore">
    <div class="item" style="grid-row: foo / autofoo" data-offset-y="10" data-offset-x="0" data-expected-height="40" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedBefore">
    <div class="item" style="grid-row: bar / 5 autofoo" data-offset-y="50" data-offset-x="0" data-expected-height="297" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedBefore gap">
    <div class="item" style="grid-row: 1 / span 4" data-offset-y="0" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedBefore gap">
    <div class="item" style="grid-row: span 3 / 2 autofoo" data-offset-y="0" data-offset-x="0" data-expected-height="125" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedBefore gap">
    <div class="item" style="grid-row: notPresent / 3 autofoo" data-offset-y="267" data-offset-x="0" data-expected-height="157" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedAfter">
    <div class="item" style="grid-row: 1 / span 4" data-offset-y="0" data-offset-x="0" data-expected-height="185" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedAfter">
    <div class="item" style="grid-row: first / last 2" data-offset-y="0" data-offset-x="0" data-expected-height="60" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedAfter">
    <div class="item" style="grid-row: last 2 / foo" data-offset-y="0" data-offset-x="0" data-expected-height="80" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedAfter gap">
    <div class="item" style="grid-row: 1 / span 3" data-offset-y="0" data-offset-x="0" data-expected-height="195" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedAfter gap">
    <div class="item" style="grid-row: 3 / span 1 bar" data-offset-y="80" data-offset-x="0" data-expected-height="222" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixedAfter gap">
    <div class="item" style="grid-row: first / foo" data-offset-y="0" data-offset-x="0" data-expected-height="30" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixed">
    <div class="item" style="grid-row: 1 / span 8" data-offset-y="0" data-offset-x="0" data-expected-height="195" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixed">
    <div class="item" style="grid-row: a / autobar 2" data-offset-y="50" data-offset-x="0" data-expected-height="80" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixed">
    <div class="item" style="grid-row: autofoo / end" data-offset-y="100" data-offset-x="0" data-expected-height="95" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixed gap">
    <div class="item" style="grid-row: 1 / span 4"  data-offset-y="0" data-offset-x="0" data-expected-height="195" data-expected-width="25"></div>
</div>

<div class="grid gridAutoRepeatAndFixed gap">
    <div class="item" style="grid-row: autobar / -1"  data-offset-y="140" data-offset-x="0" data-expected-height="20" data-expected-width="25"></div>
</div>

<div class="grid gridMultipleNames">
    <div class="item" style="grid-row: 1 / -1"  data-offset-y="0" data-offset-x="0" data-expected-height="200" data-expected-width="25"></div>
</div>

<div class="grid gridMultipleNames">
    <div class="item" style="grid-row: foo 3 / 4 bar"  data-offset-y="120" data-offset-x="0" data-expected-height="40" data-expected-width="25"></div>
</div>

<div class="grid gridMultipleNames">
    <div class="item" style="grid-row: -6 / span 2 start"  data-offset-y="20" data-offset-x="0" data-expected-height="140" data-expected-width="25"></div>
</div>

<div class="grid gridMultipleNames gap">
    <div class="item" style="grid-row: -4 / -2"  data-offset-y="40" data-offset-x="0" data-expected-height="140" data-expected-width="25"></div>
</div>

<div class="grid gridMultipleNames gap">
    <div class="item" style="grid-row: bar / foo 2"  data-offset-y="160" data-offset-x="0" data-expected-height="20" data-expected-width="25"></div>
</div>

<div class="grid gridMultipleNames gap">
    <div class="item" style="grid-row: foo / bar 2"  data-offset-y="40" data-offset-x="0" data-expected-height="180" data-expected-width="25"></div>
</div>

<div class="grid gridMultipleTracks">
    <div class="item" style="grid-row: e / last;"  data-offset-y="52" data-offset-x="0" data-expected-height="148" data-expected-width="25"></div>
    <div class="item" style="grid-row: start / b;"  data-offset-y="0" data-offset-x="0" data-expected-height="52" data-expected-width="25"></div>
</div>

<div class="grid gridMultipleTracks gap">
    <div class="item" style="grid-row: c / -1;"  data-offset-y="40" data-offset-x="0" data-expected-height="160" data-expected-width="25"></div>
</div>

</body>