summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-content.html
blob: ed0b00350ac3cc36d8ca35865d471621370c319a (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
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
<!DOCTYPE html>
<html>
<head>
<style>
#justifyContentAuto {
    justify-content: auto;
}

#justifyContentBaseline {
    justify-content: baseline;
}

#justifyContentLastBaseline {
    justify-content: last-baseline;
}

#justifyContentSpaceBetween {
    justify-content: space-between;
}

#justifyContentSpaceAround {
    justify-content: space-around;
}

#justifyContentSpaceEvenly {
    justify-content: space-evenly;
}

#justifyContentStretch {
    justify-content: stretch;
}

#justifyContentStart {
    justify-content: start;
}

#justifyContentEnd {
    justify-content: end;
}

#justifyContentCenter {
    justify-content: center;
}

#justifyContentLeft {
    justify-content: left;
}

#justifyContentRight {
    justify-content: right;
}

#justifyContentFlexStart {
    justify-content: flex-start;
}

#justifyContentFlexEnd {
    justify-content: flex-end;
}

#justifyContentEndUnsafe {
    justify-content: end unsafe;
}

#justifyContentCenterUnsafe {
    justify-content: center unsafe;
}

#justifyContentRightSafe {
    justify-content: right safe;
}

#justifyContentLeftUnsafe {
    justify-content: left unsafe;
}

#justifyContentFlexStartUnsafe {
    justify-content: flex-start unsafe;
}

#justifyContentFlexEndSafe {
    justify-content: flex-end safe;
}

#justifyContentSpaceBetweenLeft {
    justify-content: space-between left;
}

#justifyContentSpaceAroundCenter {
    justify-content: space-around center;
}

#justifyContentSpaceEvenlyRight {
    justify-content: space-evenly right;
}

#justifyContentStretchStartSafe {
    justify-content: stretch start safe;
}

#justifyContentSpaceAroundEndUnsafe {
    justify-content: space-around end unsafe;
}

#justifyContentSpaceEvenlyFlexStartSafe {
    justify-content: space-evenly flex-start safe;
}

<!-- Invalid CSS cases -->
#justifyContentSpaceBetweenSafe {
    justify-content: space-between safe;
}

#justifyContentSpaceBetweenStretch {
    justify-content: space-between stretch;
}

#justifyContentSafe {
    justify-content: safe;
}

#justifyContentRightSafeUnsafe {
    justify-content: right safe unsafe;
}

#justifyContentCenterLeft {
    justify-content: center left;
}
</style>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="justifyContentAuto"></div>
<div id="justifyContentBaseline"></div>
<div id="justifyContentLastBaseline"></div>
<div id="justifyContentSpaceBetween"></div>
<div id="justifyContentSpaceAround"></div>
<div id="justifyContentSpaceEvenly"></div>
<div id="justifyContentStretch"></div>
<div id="justifyContentStart"></div>
<div id="justifyContentEnd"></div>
<div id="justifyContentCenter"></div>
<div id="justifyContentLeft"></div>
<div id="justifyContentRight"></div>
<div id="justifyContentFlexStart"></div>
<div id="justifyContentFlexEnd"></div>
<div id="justifyContentEndUnsafe"></div>
<div id="justifyContentCenterUnsafe"></div>
<div id="justifyContentRightSafe"></div>
<div id="justifyContentLeftUnsafe"></div>
<div id="justifyContentFlexStartUnsafe"></div>
<div id="justifyContentFlexEndSafe"></div>
<div id="justifyContentSpaceBetweenLeft"></div>
<div id="justifyContentSpaceAroundCenter"></div>
<div id="justifyContentSpaceEvenlyRight"></div>
<div id="justifyContentStretchStartSafe"></div>
<div id="justifyContentSpaceAroundEndUnsafe"></div>
<div id="justifyContentSpaceEvenlyFlexStartSafe"></div>

<div id="justifyContentSpaceBetweenSafe"></div>
<div id="justifyContentSpaceBetweenStretch"></div>
<div id="justifyContentSafe"></div>
<div id="justifyContentRightSafeUnsafe"></div>
<div id="justifyContentCenterLeft"></div>

<script src="resources/alignment-parsing-utils.js"></script>
<script>
description('Test that setting and getting justify-content works as expected');

debug("Test getting justify-content set through CSS");
var justifyContentAuto = document.getElementById("justifyContentAuto");
shouldBeEqualToString("getComputedStyle(justifyContentAuto, '').getPropertyValue('justify-content')", "normal");

var justifyContentBaseline = document.getElementById("justifyContentBaseline");
shouldBeEqualToString("getComputedStyle(justifyContentBaseline, '').getPropertyValue('justify-content')", "baseline");

var justifyContentLastBaseline = document.getElementById("justifyContentLastBaseline");
shouldBeEqualToString("getComputedStyle(justifyContentLastBaseline, '').getPropertyValue('justify-content')", "last-baseline");

var justifyContentSpaceBetween = document.getElementById("justifyContentSpaceBetween");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceBetween, '').getPropertyValue('justify-content')", "space-between");

var justifyContentSpaceAround = document.getElementById("justifyContentSpaceAround");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceAround, '').getPropertyValue('justify-content')", "space-around");

var justifyContentSpaceEvenly = document.getElementById("justifyContentSpaceEvenly");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceEvenly, '').getPropertyValue('justify-content')", "space-evenly");

var justifyContentStretch = document.getElementById("justifyContentStretch");
shouldBeEqualToString("getComputedStyle(justifyContentStretch, '').getPropertyValue('justify-content')", "stretch");

var justifyContentStart = document.getElementById("justifyContentStart");
shouldBeEqualToString("getComputedStyle(justifyContentStart, '').getPropertyValue('justify-content')", "start");

var justifyContentEnd = document.getElementById("justifyContentEnd");
shouldBeEqualToString("getComputedStyle(justifyContentEnd, '').getPropertyValue('justify-content')", "end");

var justifyContentCenter = document.getElementById("justifyContentCenter");
shouldBeEqualToString("getComputedStyle(justifyContentCenter, '').getPropertyValue('justify-content')", "center");

var justifyContentLeft = document.getElementById("justifyContentLeft");
shouldBeEqualToString("getComputedStyle(justifyContentLeft, '').getPropertyValue('justify-content')", "left");

var justifyContentRight = document.getElementById("justifyContentRight");
shouldBeEqualToString("getComputedStyle(justifyContentRight, '').getPropertyValue('justify-content')", "right");

var justifyContentFlexStart = document.getElementById("justifyContentFlexStart");
shouldBeEqualToString("getComputedStyle(justifyContentFlexStart, '').getPropertyValue('justify-content')", "flex-start");

var justifyContentFlexEnd = document.getElementById("justifyContentFlexEnd");
shouldBeEqualToString("getComputedStyle(justifyContentFlexEnd, '').getPropertyValue('justify-content')", "flex-end");

var justifyContentEndUnsafe = document.getElementById("justifyContentEndUnsafe");
shouldBeEqualToString("getComputedStyle(justifyContentEndUnsafe, '').getPropertyValue('justify-content')", "end unsafe");

var justifyContentCenterUnsafe = document.getElementById("justifyContentCenterUnsafe");
shouldBeEqualToString("getComputedStyle(justifyContentCenterUnsafe, '').getPropertyValue('justify-content')", "center unsafe");

var justifyContentRightSafe = document.getElementById("justifyContentRightSafe");
shouldBeEqualToString("getComputedStyle(justifyContentRightSafe, '').getPropertyValue('justify-content')", "right safe");

var justifyContentLeftUnsafe = document.getElementById("justifyContentLeftUnsafe");
shouldBeEqualToString("getComputedStyle(justifyContentLeftUnsafe, '').getPropertyValue('justify-content')", "left unsafe");

var justifyContentFlexStartUnsafe = document.getElementById("justifyContentFlexStartUnsafe");
shouldBeEqualToString("getComputedStyle(justifyContentFlexStartUnsafe, '').getPropertyValue('justify-content')", "flex-start unsafe");

var justifyContentFlexEndSafe = document.getElementById("justifyContentFlexEndSafe");
shouldBeEqualToString("getComputedStyle(justifyContentFlexEndSafe, '').getPropertyValue('justify-content')", "flex-end safe");

var justifyContentSpaceBetweenLeft = document.getElementById("justifyContentSpaceBetweenLeft");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceBetweenLeft, '').getPropertyValue('justify-content')", "space-between left");

var justifyContentSpaceAroundCenter = document.getElementById("justifyContentSpaceAroundCenter");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceAroundCenter, '').getPropertyValue('justify-content')", "space-around center");

var justifyContentSpaceEvenlyRight = document.getElementById("justifyContentSpaceEvenlyRight");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceEvenlyRight, '').getPropertyValue('justify-content')", "space-evenly right");

var justifyContentStretchStartSafe = document.getElementById("justifyContentStretchStartSafe");
shouldBeEqualToString("getComputedStyle(justifyContentStretchStartSafe, '').getPropertyValue('justify-content')", "stretch start safe");

var justifyContentSpaceAroundEndUnsafe = document.getElementById("justifyContentSpaceAroundEndUnsafe");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceAroundEndUnsafe, '').getPropertyValue('justify-content')", "space-around end unsafe");

var justifyContentSpaceEvenlyFlexStartSafe = document.getElementById("justifyContentSpaceEvenlyFlexStartSafe");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceEvenlyFlexStartSafe, '').getPropertyValue('justify-content')", "space-evenly flex-start safe");

var justifyContentSpaceBetweenSafe = document.getElementById("justifyContentSpaceBetweenSafe");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceBetweenSafe, '').getPropertyValue('justify-content')", "normal");

var justifyContentSpaceAroundUnsafe = document.getElementById("justifyContentSpaceBetweenStretch");
shouldBeEqualToString("getComputedStyle(justifyContentSpaceBetweenStretch, '').getPropertyValue('justify-content')", "normal");

var justifyContentSpaceAroundUnsafe = document.getElementById("justifyContentSafe");
shouldBeEqualToString("getComputedStyle(justifyContentSafe, '').getPropertyValue('justify-content')", "normal");

var justifyContentSpaceAroundUnsafe = document.getElementById("justifyContentRightSafeUnsafe");
shouldBeEqualToString("getComputedStyle(justifyContentRightSafeUnsafe, '').getPropertyValue('justify-content')", "normal");

var justifyContentSpaceAroundUnsafe = document.getElementById("justifyContentCenterLeft");
shouldBeEqualToString("getComputedStyle(justifyContentCenterLeft, '').getPropertyValue('justify-content')", "normal");

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

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

element.style.justifyContent = "unsafe start";
checkValues(element, "justifyContent", "justify-content",  "start unsafe", "start unsafe");

element.style.justifyContent = "flex-end safe";
checkValues(element, "justifyContent", "justify-content",  "flex-end safe", "flex-end safe");

element.style.justifyContent = "space-between right safe";
checkValues(element, "justifyContent", "justify-content",  "space-between right safe", "space-between right safe");

element.style.justifyContent = "center stretch";
checkValues(element, "justifyContent", "justify-content",  "stretch center", "stretch center");

element.style.justifyContent = "right unsafe";
checkValues(element, "justifyContent", "justify-content",  "right unsafe", "right unsafe");

element.style.justifyContent = "normal";
checkValues(element, "justifyContent", "justify-content",  "normal", "normal");

element.style.display = "flex";
element.style.justifyContent = "normal";
checkValues(element, "justifyContent", "justify-content",  "normal", "normal");

element.style.display = "grid";
element.style.justifyContent = "normal";
checkValues(element, "justifyContent", "justify-content",  "normal", "normal");

element.style.justifyContent = "flex-end";
checkValues(element, "justifyContent", "justify-content",  "flex-end", "flex-end");

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

checkBadValues(element, "justifyContent", "justify-content",  "");
checkBadValues(element, "justifyContent", "justify-content",  "auto");
checkBadValues(element, "justifyContent", "justify-content",  "unsafe auto");
checkBadValues(element, "justifyContent", "justify-content",  "auto safe");
checkBadValues(element, "justifyContent", "justify-content",  "auto left");
checkBadValues(element, "justifyContent", "justify-content",  "baseline safe");
checkBadValues(element, "justifyContent", "justify-content",  "last baseline center");
checkBadValues(element, "justifyContent", "justify-content",  "unsafe unsafe");
checkBadValues(element, "justifyContent", "justify-content",  "unsafe safe");
checkBadValues(element, "justifyContent", "justify-content",  "center start");
checkBadValues(element, "justifyContent", "justify-content",  "baseline safe");
checkBadValues(element, "justifyContent", "justify-content",  "unsafe baseline");
checkBadValues(element, "justifyContent", "justify-content",  "unsafe safe left");
checkBadValues(element, "justifyContent", "justify-content",  "unsafe left safe");
checkBadValues(element, "justifyContent", "justify-content",  "left safe unsafe safe");
checkBadValues(element, "justifyContent", "justify-content",  "start right space-between");
checkBadValues(element, "justifyContent", "justify-content",  "safe stretch");
checkBadValues(element, "justifyContent", "justify-content",  "space-around stretch");
checkBadValues(element, "justifyContent", "justify-content",  "end space-between start");
checkBadValues(element, "justifyContent", "justify-content",  "right safe left");
checkBadValues(element, "justifyContent", "justify-content",  "unsafe");
checkBadValues(element, "justifyContent", "justify-content",  "safe");

debug("");
debug("Test the value 'initial'");
element.style.display = "";
checkInitialValues(element, "justifyContent", "justify-content", "stretch center", "normal");

debug("");
debug("Test the value 'initial' for grid containers");
element.style.display = "grid";
checkInitialValues(element, "justifyContent", "justify-content", "space-between left", "normal");

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

debug("");
debug("Test the value 'inherit'");
checkInheritValues("justifyContent", "justify-content", "end");
checkInheritValues("justifyContent", "justify-content", "left safe");
checkInheritValues("justifyContent", "justify-content", "stretch center");

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