summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-items.html
blob: d1e8c77f5ce9cf604281efa0cac1ad04efd9e67f (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
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
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
<!DOCTYPE html>
<html>
<head>
<style>
#justifyItemsBaseline {
    justify-items: baseline;
}

#justifyItemsLastBaseline {
    justify-items: last-baseline;
}

#justifyItemsStretch {
    justify-items: stretch;
}

#justifyItemsStart {
    justify-items: start;
}

#justifyItemsEnd {
    justify-items: end;
}

#justifyItemsCenter {
    justify-items: center;
}

#justifyItemsSelfStart {
    justify-items: self-start;
}

#justifyItemsSelfEnd {
    justify-items: self-end;
}

#justifyItemsLeft {
    justify-items: left;
}

#justifyItemsRight {
    justify-items: right;
}

#justifyItemsFlexStart {
    justify-items: flex-start;
}

#justifyItemsFlexEnd {
    justify-items: flex-end;
}

#justifyItemsEndUnsafe {
    justify-items: end unsafe;
}

#justifyItemsCenterUnsafe {
    justify-items: center unsafe;
}

#justifyItemsSelfEndSafe {
    justify-items: self-end safe;
}

#justifyItemsSelfStartSafe {
    justify-items: self-start safe;
}

#justifyItemsRightSafe {
    justify-items: right safe;
}

#justifyItemsLeftUnsafe {
    justify-items: left unsafe;
}

#justifyItemsFlexStartUnsafe {
    justify-items: flex-start unsafe;
}

#justifyItemsFlexEndSafe {
    justify-items: flex-end safe;
}

#justifyItemsLegacyLeft {
    justify-items: legacy left;
}

#justifyItemsLegacyCenter {
    justify-items: legacy center;
}

#justifyItemsLegacyRight {
    justify-items: legacy right;
}

#justifyItemsLeftLegacy {
    justify-items: left legacy;
}

#justifyItemsCenterLegacy {
    justify-items: center legacy;
}

#justifyItemsRightLegacy {
    justify-items: right legacy;
}
</style>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="justifyItemsBaseline"></div>
<div id="justifyItemsLastBaseline"></div>
<div id="justifyItemsStretch"></div>
<div id="justifyItemsStart"></div>
<div id="justifyItemsEnd"></div>
<div id="justifyItemsCenter"></div>
<div id="justifyItemsSelfStart"></div>
<div id="justifyItemsSelfEnd"></div>
<div id="justifyItemsLeft"></div>
<div id="justifyItemsRight"></div>
<div id="justifyItemsFlexStart"></div>
<div id="justifyItemsFlexEnd"></div>

<div id="justifyItemsEndUnsafe"></div>
<div id="justifyItemsCenterUnsafe"></div>
<div id="justifyItemsSelfEndSafe"></div>
<div id="justifyItemsSelfStartSafe"></div>
<div id="justifyItemsRightSafe"></div>
<div id="justifyItemsLeftUnsafe"></div>
<div id="justifyItemsFlexStartUnsafe"></div>
<div id="justifyItemsFlexEndSafe"></div>
<div id="justifyItemsLegacyLeft"></div>
<div id="justifyItemsLegacyCenter"></div>
<div id="justifyItemsLegacyRight"></div>
<div id="justifyItemsLeftLegacy"></div>
<div id="justifyItemsCenterLegacy"></div>
<div id="justifyItemsRightLegacy"></div>
<script src="resources/alignment-parsing-utils.js"></script>
<script>
description('Test that setting and getting justify-items works as expected');

debug("Test getting justify-items set through CSS");
var justifyItemsBaseline = document.getElementById("justifyItemsBaseline");
shouldBe("getComputedStyle(justifyItemsBaseline, '').getPropertyValue('justify-items')", "'baseline'");

var justifyItemsLastBaseline = document.getElementById("justifyItemsLastBaseline");
shouldBe("getComputedStyle(justifyItemsLastBaseline, '').getPropertyValue('justify-items')", "'last-baseline'");

var justifyItemsStretch = document.getElementById("justifyItemsStretch");
shouldBe("getComputedStyle(justifyItemsStretch, '').getPropertyValue('justify-items')", "'stretch'");

var justifyItemsStart = document.getElementById("justifyItemsStart");
shouldBe("getComputedStyle(justifyItemsStart, '').getPropertyValue('justify-items')", "'start'");

var justifyItemsEnd = document.getElementById("justifyItemsEnd");
shouldBe("getComputedStyle(justifyItemsEnd, '').getPropertyValue('justify-items')", "'end'");

var justifyItemsCenter = document.getElementById("justifyItemsCenter");
shouldBe("getComputedStyle(justifyItemsCenter, '').getPropertyValue('justify-items')", "'center'");

var justifyItemsSelfEnd = document.getElementById("justifyItemsSelfEnd");
shouldBe("getComputedStyle(justifyItemsSelfEnd, '').getPropertyValue('justify-items')", "'self-end'");

var justifyItemsSelfStart = document.getElementById("justifyItemsSelfStart");
shouldBe("getComputedStyle(justifyItemsSelfStart, '').getPropertyValue('justify-items')", "'self-start'");

var justifyItemsLeft = document.getElementById("justifyItemsLeft");
shouldBe("getComputedStyle(justifyItemsLeft, '').getPropertyValue('justify-items')", "'left'");

var justifyItemsRight = document.getElementById("justifyItemsRight");
shouldBe("getComputedStyle(justifyItemsRight, '').getPropertyValue('justify-items')", "'right'");

var justifyItemsFlexStart = document.getElementById("justifyItemsFlexStart");
shouldBe("getComputedStyle(justifyItemsFlexStart, '').getPropertyValue('justify-items')", "'flex-start'");

var justifyItemsFlexEnd = document.getElementById("justifyItemsFlexEnd");
shouldBe("getComputedStyle(justifyItemsFlexEnd, '').getPropertyValue('justify-items')", "'flex-end'");

var justifyItemsEndUnsafe = document.getElementById("justifyItemsEndUnsafe");
shouldBe("getComputedStyle(justifyItemsEndUnsafe, '').getPropertyValue('justify-items')", "'end unsafe'");

var justifyItemsCenterUnsafe = document.getElementById("justifyItemsCenterUnsafe");
shouldBe("getComputedStyle(justifyItemsCenterUnsafe, '').getPropertyValue('justify-items')", "'center unsafe'");

var justifyItemsSelfEndSafe = document.getElementById("justifyItemsSelfEndSafe");
shouldBe("getComputedStyle(justifyItemsSelfEndSafe, '').getPropertyValue('justify-items')", "'self-end safe'");

var justifyItemsSelfStartSafe = document.getElementById("justifyItemsSelfStartSafe");
shouldBe("getComputedStyle(justifyItemsSelfStartSafe, '').getPropertyValue('justify-items')", "'self-start safe'");

var justifyItemsRightSafe = document.getElementById("justifyItemsRightSafe");
shouldBe("getComputedStyle(justifyItemsRightSafe, '').getPropertyValue('justify-items')", "'right safe'");

var justifyItemsLeftUnsafe = document.getElementById("justifyItemsLeftUnsafe");
shouldBe("getComputedStyle(justifyItemsLeftUnsafe, '').getPropertyValue('justify-items')", "'left unsafe'");

var justifyItemsFlexStartUnsafe = document.getElementById("justifyItemsFlexStartUnsafe");
shouldBe("getComputedStyle(justifyItemsFlexStartUnsafe, '').getPropertyValue('justify-items')", "'flex-start unsafe'");

var justifyItemsFlexEndSafe = document.getElementById("justifyItemsFlexEndSafe");
shouldBe("getComputedStyle(justifyItemsFlexEndSafe, '').getPropertyValue('justify-items')", "'flex-end safe'");

var justifyItemsLegacyLeft = document.getElementById("justifyItemsLegacyLeft");
shouldBe("getComputedStyle(justifyItemsLegacyLeft, '').getPropertyValue('justify-items')", "'legacy left'");

var justifyItemsLegacyCenter = document.getElementById("justifyItemsLegacyCenter");
shouldBe("getComputedStyle(justifyItemsLegacyCenter, '').getPropertyValue('justify-items')", "'legacy center'");

var justifyItemsLegacyRight = document.getElementById("justifyItemsLegacyRight");
shouldBe("getComputedStyle(justifyItemsLegacyRight, '').getPropertyValue('justify-items')", "'legacy right'");

var justifyItemsLeftLegacy = document.getElementById("justifyItemsLeftLegacy");
shouldBe("getComputedStyle(justifyItemsLeftLegacy, '').getPropertyValue('justify-items')", "'legacy left'");

var justifyItemsCenterLegacy = document.getElementById("justifyItemsCenterLegacy");
shouldBe("getComputedStyle(justifyItemsCenterLegacy, '').getPropertyValue('justify-items')", "'legacy center'");

var justifyItemsRightLegacy = document.getElementById("justifyItemsRightLegacy");
shouldBe("getComputedStyle(justifyItemsRightLegacy, '').getPropertyValue('justify-items')", "'legacy right'");

debug("");
debug("Test initial value of justify-items through JS");
element = document.createElement("div");
document.body.appendChild(element);
shouldBe("getComputedStyle(element, '').getPropertyValue('justify-items')", "'start'");

debug("");
debug("Test getting and setting justify-items through JS");
element = document.createElement("div");
document.body.appendChild(element);
element.style.justifyItems = "center";
checkValues(element, "justifyItems", "justify-items",  "center", "center");

element.style.justifyItems = "unsafe start";
checkValues(element, "justifyItems", "justify-items",  "start unsafe", "start unsafe");

element.style.justifyItems = "flex-end safe";
checkValues(element, "justifyItems", "justify-items",  "flex-end safe", "flex-end safe");

element.style.justifyItems = "right legacy";
checkValues(element, "justifyItems", "justify-items",  "legacy right", "legacy right");

element.style.justifyItems = "center legacy";
checkValues(element, "justifyItems", "justify-items",  "legacy center", "legacy center");

element.style.justifyItems = "left legacy";
checkValues(element, "justifyItems", "justify-items",  "legacy left", "legacy left");

element.style.justifyItems = "auto";
checkValues(element, "justifyItems", "justify-items",  "auto", "start");

element.style.display = "flex";
element.style.justifyItems = "auto";
checkValues(element, "justifyItems", "justify-items",  "auto", "stretch");

element.style.display = "grid";
element.style.justifyItems = "auto";
checkValues(element, "justifyItems", "justify-items",  "auto", "stretch");

element.style.justifyItems = "self-end";
checkValues(element, "justifyItems", "justify-items",  "self-end", "self-end");

debug("");
debug("Test bad combinations of justify-items");
element = document.createElement("div");
document.body.appendChild(element);

checkBadValues(element, "justifyItems", "justify-items",  "unsafe auto");
checkBadValues(element, "justifyItems", "justify-items",  "auto safe");
checkBadValues(element, "justifyItems", "justify-items",  "auto left");
checkBadValues(element, "justifyItems", "justify-items",  "baseline safe");
checkBadValues(element, "justifyItems", "justify-items",  "baseline center");
checkBadValues(element, "justifyItems", "justify-items",  "stretch unsafe");
checkBadValues(element, "justifyItems", "justify-items",  "stretch right");
checkBadValues(element, "justifyItems", "justify-items",  "unsafe unsafe");
checkBadValues(element, "justifyItems", "justify-items",  "unsafe safe");
checkBadValues(element, "justifyItems", "justify-items",  "center start");
checkBadValues(element, "justifyItems", "justify-items",  "stretch unsafe");
checkBadValues(element, "justifyItems", "justify-items",  "safe stretch");
checkBadValues(element, "justifyItems", "justify-items",  "baseline safe");
checkBadValues(element, "justifyItems", "justify-items",  "unsafe baseline");
checkBadValues(element, "justifyItems", "justify-items",  "unsafe safe left");
checkBadValues(element, "justifyItems", "justify-items",  "unsafe left safe");
checkBadValues(element, "justifyItems", "justify-items",  "left safe unsafe safe");
checkBadValues(element, "justifyItems", "justify-items",  "legacy start");
checkBadValues(element, "justifyItems", "justify-items",  "legacy end");
checkBadValues(element, "justifyItems", "justify-items",  "legacy right unsafe");
checkBadValues(element, "justifyItems", "justify-items",  "legacy auto");
checkBadValues(element, "justifyItems", "justify-items",  "legacy stretch");
checkBadValues(element, "justifyItems", "justify-items",  "legacy");
checkBadValues(element, "justifyItems", "justify-items",  "legacy left right");

debug("");
debug("Test the value 'initial'");
element.style.display = "";
checkInitialValues(element, "justifyItems", "justify-items", "legacy center", "start");

debug("");
debug("Test the value 'initial' for grid containers");
element.style.display = "grid";
checkInitialValues(element, "justifyItems", "justify-items", "left safe", "stretch");

debug("");
debug("Test the value 'initial' for flex containers");
element.style.display = "flex";
checkInitialValues(element, "justifyItems", "justify-items", "right unsafe", "stretch");

debug("");
debug("Test the value 'inherit'");
checkInheritValues("justifyItems", "justify-items", "end");
checkInheritValues("justifyItems", "justify-items", "left safe");
checkInheritValues("justifyItems", "justify-items", "legacy center");

debug("");
debug("Test the value 'legacy'");
checkLegacyValues("justifyItems", "justify-items", "legacy left");
checkLegacyValues("justifyItems", "justify-items", "legacy center");
checkLegacyValues("justifyItems", "justify-items", "legacy right");

</script>
</body>
</html>