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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
|
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>grid-template-rows composition</title>
<link rel="help" href="https://drafts.csswg.org/css-grid/#track-sizing">
<meta name="assert" content="grid-template-rows supports composition.">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="/css/support/interpolation-testcommon.js"></script>
</head>
<body>
<script>
'use strict';
test_composition({
property: 'grid-template-rows',
underlying: '50px 10%',
addFrom: '100px 100px',
addTo: '200px 20%',
}, [
{at: -0.3, expect: '120px calc(130px + 4%)'},
{at: 0, expect: '150px calc(100px + 10%)'},
{at: 0.5, expect: '200px calc(50px + 20%)'},
{at: 1, expect: '250px 30%'},
{at: 1.5, expect: '300px calc(-50px + 40%)'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr 1fr',
addFrom: '1fr 2fr',
addTo: '2fr 1fr',
}, [
{at: -0.5, expect: '1.5fr 3.5fr'},
{at: 0, expect: '2fr 3fr'},
{at: 0.5, expect: '2.5fr 2.5fr'},
{at: 1, expect: '3fr 2fr'},
{at: 1.5, expect: '3.5fr 1.5fr'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '50px',
addFrom: '100px',
replaceTo: '200px',
}, [
{at: -0.3, expect: '135px'},
{at: 0, expect: '150px'},
{at: 0.5, expect: '175px'},
{at: 1, expect: '200px'},
{at: 1.5, expect: '225px'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr',
addFrom: '1fr',
replaceTo: '3fr',
}, [
{at: -0.5, expect: '1.5fr'},
{at: 0, expect: '2fr'},
{at: 0.5, expect: '2.5fr'},
{at: 1, expect: '3fr'},
{at: 1.5, expect: '3.5fr'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr 1fr',
addFrom: '1fr 1fr',
addTo: '3fr auto',
}, [
{at: -0.5, expect: '1fr 2fr'},
{at: 0, expect: '2fr 2fr'},
{at: 0.5, expect: '3fr auto'},
{at: 1, expect: '4fr auto'},
{at: 1.5, expect: '5fr auto'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr 1fr',
addFrom: '1fr auto',
addTo: '3fr 3fr',
}, [
{at: -0.5, expect: '1fr auto'},
{at: 0, expect: '2fr auto'},
{at: 0.5, expect: '3fr 4fr'},
{at: 1, expect: '4fr 4fr'},
{at: 1.5, expect: '5fr 4fr'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr auto',
addFrom: '1fr 1fr',
addTo: '3fr 3fr',
}, [
{at: -0.5, expect: '1fr 0fr'},
{at: 0, expect: '2fr 1fr'},
{at: 0.5, expect: '3fr 2fr'},
{at: 1, expect: '4fr 3fr'},
{at: 1.5, expect: '5fr 4fr'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '0fr repeat(2, 0fr 10px) 1fr',
addFrom: "1fr repeat(2, 1fr 20px) 1fr",
addTo: "2fr repeat(2, 3fr 40px) 3fr"
}, [
{at: -0.3, expect: "0.7fr repeat(2, 0.4fr 24px) 1.4fr"},
{at: 0, expect: "1fr repeat(2, 1fr 30px) 2fr"},
{at: 0.5, expect: "1.5fr repeat(2, 2fr 40px) 3fr"},
{at: 1, expect: "2fr repeat(2, 3fr 50px) 4fr"},
{at: 1.5, expect: "2.5fr repeat(2, 4fr 60px) 5fr"}
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr 1fr',
addFrom: '1fr [a b] 1fr [d]',
addTo: '3fr [c] 3fr',
}, [
{at: -0.5, expect: '1fr [ a b ] 1fr [d]'},
{at: 0, expect: '2fr [ a b ] 2fr [d]'},
{at: 0.5, expect: '3fr [c] 3fr'},
{at: 1, expect: '4fr [c] 4fr'},
{at: 1.5, expect: '5fr [c] 5fr'},
]);
test_composition({
property: 'grid-template-rows',
underlying: 'fit-content(5px) fit-content(20px)',
addFrom: 'fit-content(5px) fit-content(20px)',
addTo: 'fit-content(15px) max-content',
}, [
{at: -0.5, expect: 'fit-content(5px) fit-content(40px)'},
{at: 0, expect: 'fit-content(10px) fit-content(40px)'},
{at: 0.5, expect: 'fit-content(15px) max-content'},
{at: 1, expect: 'fit-content(20px) max-content'},
{at: 1.5, expect: 'fit-content(25px) max-content'},
]);
test_composition({
property: 'grid-template-rows',
underlying: 'minmax(5px, 1fr) minmax(10px, 2fr)',
addFrom: 'minmax(5px, 1fr) minmax(10px, 2fr)',
addTo: 'minmax(15px, 3fr) minmax(30px, auto)',
}, [
{at: -0.5, expect: 'minmax(5px, 1fr) minmax(10px, 4fr)'},
{at: 0, expect: 'minmax(10px, 2fr) minmax(20px, 4fr)'},
{at: 0.5, expect: 'minmax(15px, 3fr) minmax(30px, auto)'},
{at: 1, expect: 'minmax(20px, 4fr) minmax(40px, auto)'},
{at: 1.5, expect: 'minmax(25px, 5fr) minmax(50px, auto)'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr 1fr',
addFrom: 'none',
addTo: '1fr 1fr',
}, [
{at: -0.5, expect: 'none'},
{at: 0, expect: 'none'},
{at: 0.3, expect: 'none'},
{at: 0.5, expect: '2fr 2fr'},
{at: 0.7, expect: '2fr 2fr'},
{at: 1, expect: '2fr 2fr'},
{at: 1.5, expect: '2fr 2fr'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr 1fr',
addFrom: '1fr 1fr',
addTo: 'none',
}, [
{at: -0.5, expect: '2fr 2fr'},
{at: 0, expect: '2fr 2fr'},
{at: 0.3, expect: '2fr 2fr'},
{at: 0.5, expect: 'none'},
{at: 0.7, expect: 'none'},
{at: 1, expect: 'none'},
{at: 1.5, expect: 'none'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '1fr 1fr 1fr',
addFrom: '1fr 1fr 1fr',
addTo: '2fr 2fr',
}, [
{at: -0.5, expect: '2fr 2fr 2fr'},
{at: 0, expect: '2fr 2fr 2fr'},
{at: 0.3, expect: '2fr 2fr 2fr'},
{at: 0.5, expect: '2fr 2fr'},
{at: 0.7, expect: '2fr 2fr'},
{at: 1, expect: '2fr 2fr'},
{at: 1.5, expect: '2fr 2fr'},
]);
test_composition({
property: 'grid-template-rows',
underlying: '10px 20px 30px',
addFrom: '15px 4px',
addTo: '30px 3px',
}, [
{at: -0.5, expect: '7.5px 4.5px'},
{at: 0, expect: '15px 4px'},
{at: 0.5, expect: '22.5px 3.5px'},
{at: 1, expect: '30px 3px'},
{at: 1.5, expect: '37.5px 2.5px'},
]);
test_composition({
property: 'grid-template-rows',
addFrom: "repeat(2, 2fr 30px)",
addTo: "repeat(3, 3fr 50px)"
}, [
{at: -0.5, expect: 'repeat(2, 2fr 30px)'},
{at: 0, expect: 'repeat(2, 2fr 30px)'},
{at: 0.3, expect: 'repeat(2, 2fr 30px)'},
{at: 0.5, expect: 'repeat(3, 3fr 50px)'},
{at: 0.7, expect: 'repeat(3, 3fr 50px)'},
{at: 1, expect: 'repeat(3, 3fr 50px)'},
{at: 1.5, expect: 'repeat(3, 3fr 50px)'},
]);
test_composition({
property: 'grid-template-rows',
addFrom: "repeat(2, 2fr 30px)",
addTo: "repeat(2, 3fr)"
}, [
{at: -0.5, expect: 'repeat(2, 2fr 30px)'},
{at: 0, expect: 'repeat(2, 2fr 30px)'},
{at: 0.3, expect: 'repeat(2, 2fr 30px)'},
{at: 0.5, expect: 'repeat(2, 3fr)'},
{at: 0.7, expect: 'repeat(2, 3fr)'},
{at: 1, expect: 'repeat(2, 3fr)'},
{at: 1.5, expect: 'repeat(2, 3fr)'},
]);
</script>
</body>
</html>
|