summaryrefslogtreecommitdiffstats
path: root/third_party/WebKit/LayoutTests/fast/alignment/parse-justify-self.html
blob: d80089b69c383465d233f864a1a1a5021d5aa208 (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
<!DOCTYPE html>
<html>
<head>
<style>
#justifySelfBaseline {
    justify-self: baseline;
}

#justifySelfLastBaseline {
    justify-self: last-baseline;
}

#justifySelfStretch {
    justify-self: stretch;
}

#justifySelfStart {
    justify-self: start;
}

#justifySelfEnd {
    justify-self: end;
}

#justifySelfCenter {
    justify-self: center;
}

#justifySelfSelfStart {
    justify-self: self-start;
}

#justifySelfSelfEnd {
    justify-self: self-end;
}

#justifySelfLeft {
    justify-self: left;
}

#justifySelfRight {
    justify-self: right;
}

#justifySelfFlexStart {
    justify-self: flex-start;
}

#justifySelfFlexEnd {
    justify-self: flex-end;
}

#justifySelfEndUnsafe {
    justify-self: end unsafe;
}

#justifySelfCenterUnsafe {
    justify-self: center unsafe;
}

#justifySelfSelfEndSafe {
    justify-self: self-end safe;
}

#justifySelfSelfStartSafe {
    justify-self: self-start safe;
}

#justifySelfRightSafe {
    justify-self: right safe;
}

#justifySelfLeftUnsafe {
    justify-self: left unsafe;
}

#justifySelfFlexStartUnsafe {
    justify-self: flex-start unsafe;
}

#justifySelfFlexEndSafe {
    justify-self: flex-end safe;
}
</style>
<script src="../../resources/js-test.js"></script>
</head>
<body>
<div id="justifySelfBaseline"></div>
<div id="justifySelfLastBaseline"></div>
<div id="justifySelfStretch"></div>
<div id="justifySelfStart"></div>
<div id="justifySelfEnd"></div>
<div id="justifySelfCenter"></div>
<div id="justifySelfSelfStart"></div>
<div id="justifySelfSelfEnd"></div>
<div id="justifySelfLeft"></div>
<div id="justifySelfRight"></div>
<div id="justifySelfFlexStart"></div>
<div id="justifySelfFlexEnd"></div>

<div id="justifySelfEndUnsafe"></div>
<div id="justifySelfCenterUnsafe"></div>
<div id="justifySelfSelfEndSafe"></div>
<div id="justifySelfSelfStartSafe"></div>
<div id="justifySelfRightSafe"></div>
<div id="justifySelfLeftUnsafe"></div>
<div id="justifySelfFlexStartUnsafe"></div>
<div id="justifySelfFlexEndSafe"></div>
<script src="resources/alignment-parsing-utils.js"></script>
<script>
description('Test that setting and getting justify-self works as expected');

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

element.style.justifySelf = "unsafe start";
checkValues(element, "justifySelf", "justify-self",  "start unsafe", "start unsafe");

element.style.justifySelf = "flex-end safe";
checkValues(element, "justifySelf", "justify-self",  "flex-end safe", "flex-end safe");

element.style.justifySelf = "right";
checkValues(element, "justifySelf", "justify-self",  "right", "right");

element.style.justifySelf = "center";
checkValues(element, "justifySelf", "justify-self",  "center", "center");

element.style.justifySelf = "self-start";
checkValues(element, "justifySelf", "justify-self",  "self-start", "self-start");

element.style.justifySelf = "auto";
checkValues(element, "justifySelf", "justify-self",  "auto", "start");

container.style.display = "flex";
element.style.justifySelf = "auto";
checkValues(element, "justifySelf", "justify-self",  "auto", "stretch");

container.style.display = "grid";
element.style.justifySelf = "auto";
checkValues(element, "justifySelf", "justify-self",  "auto", "stretch");

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

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

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

debug("");
debug("Test the value 'initial'");
container.style.display = "";
checkInitialValues(element, "justifySelf", "justify-self", "center", "start");

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

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

debug("");
debug("Test the value 'initial' for positioned elements");
container.style.display = "";
element.style.position = "absolute";
checkInitialValues(element, "justifySelf", "justify-self", "left", "stretch");

debug("");
debug("Test the value 'initial' for positioned elements in grid containers");
container.style.display = "grid";
element.style.position = "absolute";
checkInitialValues(element, "justifySelf", "justify-self", "right", "stretch");

debug("");
debug("Test the value 'initial' for positioned elements in grid containers");
container.style.display = "flex";
element.style.position = "absolute";
checkInitialValues(element, "justifySelf", "justify-self", "end", "stretch");

debug("");
debug("Test the value 'inherit'");
checkInheritValues("justifySelf", "justify-self", "end");
checkInheritValues("justifySelf", "justify-self", "left safe");
checkInheritValues("justifySelf", "justify-self", "center unsafe");

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