forked from WebKit/WebKit-http
-
Notifications
You must be signed in to change notification settings - Fork 0
/
parse-align-items.html
247 lines (211 loc) · 10.3 KB
/
parse-align-items.html
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>
<style>
#alignItemsBaseline {
align-items: baseline;
}
#alignItemsFirstBaseline {
align-items: first baseline;
}
#alignItemsLastBaseline {
align-items: last baseline;
}
#alignItemsStretch {
align-items: stretch;
}
#alignItemsNormal {
align-items: normal;
}
#alignItemsStart {
align-items: start;
}
#alignItemsEnd {
align-items: end;
}
#alignItemsCenter {
align-items: center;
}
#alignItemsSelfStart {
align-items: self-start;
}
#alignItemsSelfEnd {
align-items: self-end;
}
#alignItemsFlexStart {
align-items: flex-start;
}
#alignItemsFlexEnd {
align-items: flex-end;
}
#alignItemsUnsafeEnd {
align-items: unsafe end ;
}
#alignItemsUnsafeCenter {
align-items: unsafe center ;
}
#alignItemsSafeSelfEnd {
align-items: safe self-end;
}
#alignItemsSafeSelfStart {
align-items: safe self-start;
}
#alignItemsUnsafeFlexStart {
align-items: unsafe flex-start;
}
#alignItemsSafeFlexEnd {
align-items: safe flex-end;
}
</style>
<p>Test that setting and getting align-items works as expected</p>
<div id="alignItemsBaseline"></div>
<div id="alignItemsFirstBaseline"></div>
<div id="alignItemsLastBaseline"></div>
<div id="alignItemsStretch"></div>
<div id="alignItemsNormal"></div>
<div id="alignItemsStart"></div>
<div id="alignItemsEnd"></div>
<div id="alignItemsCenter"></div>
<div id="alignItemsSelfStart"></div>
<div id="alignItemsSelfEnd"></div>
<div id="alignItemsFlexStart"></div>
<div id="alignItemsFlexEnd"></div>
<div id="alignItemsUnsafeEnd"></div>
<div id="alignItemsUnsafeCenter"></div>
<div id="alignItemsSafeSelfEnd"></div>
<div id="alignItemsSafeSelfStart"></div>
<div id="alignItemsUnsafeFlexStart"></div>
<div id="alignItemsSafeFlexEnd"></div>
<script src="../resources/testharness.js"></script>
<script src="../resources/testharnessreport.js"></script>
<script src="resources/alignment-parsing-utils-th.js"></script>
<script>
test(function() {
var alignItemsBaseline = document.getElementById("alignItemsBaseline");
checkValues(alignItemsBaseline, "alignItems", "align-items", "", "baseline");
var alignItemsFirstBaseline = document.getElementById("alignItemsFirstBaseline");
checkValues(alignItemsFirstBaseline, "alignItems", "align-items", "", "baseline");
var alignItemsLastBaseline = document.getElementById("alignItemsLastBaseline");
checkValues(alignItemsLastBaseline, "alignItems", "align-items", "", "last baseline");
var alignItemsStretch = document.getElementById("alignItemsStretch");
checkValues(alignItemsStretch, "alignItems", "align-items", "", "stretch");
var alignItemsNormal = document.getElementById("alignItemsNormal");
checkValues(alignItemsNormal, "alignItems", "align-items", "", "normal");
var alignItemsStart = document.getElementById("alignItemsStart");
checkValues(alignItemsStart, "alignItems", "align-items", "", "start");
var alignItemsEnd = document.getElementById("alignItemsEnd");
checkValues(alignItemsEnd, "alignItems", "align-items", "", "end");
var alignItemsCenter = document.getElementById("alignItemsCenter");
checkValues(alignItemsCenter, "alignItems", "align-items", "", "center");
var alignItemsSelfEnd = document.getElementById("alignItemsSelfEnd");
checkValues(alignItemsSelfEnd, "alignItems", "align-items", "", "self-end");
var alignItemsSelfStart = document.getElementById("alignItemsSelfStart");
checkValues(alignItemsSelfStart, "alignItems", "align-items", "", "self-start");
var alignItemsFlexStart = document.getElementById("alignItemsFlexStart");
checkValues(alignItemsFlexStart, "alignItems", "align-items", "", "flex-start");
var alignItemsFlexEnd = document.getElementById("alignItemsFlexEnd");
checkValues(alignItemsFlexEnd, "alignItems", "align-items", "", "flex-end");
var alignItemsUnsafeEnd = document.getElementById("alignItemsUnsafeEnd");
checkValues(alignItemsUnsafeEnd, "alignItems", "align-items", "", "unsafe end");
var alignItemsUnsafeCenter = document.getElementById("alignItemsUnsafeCenter");
checkValues(alignItemsUnsafeCenter, "alignItems", "align-items", "", "unsafe center");
var alignItemsSafeSelfEnd = document.getElementById("alignItemsSafeSelfEnd");
checkValues(alignItemsSafeSelfEnd, "alignItems", "align-items", "", "safe self-end");
var alignItemsSafeSelfStart = document.getElementById("alignItemsSafeSelfStart");
checkValues(alignItemsSafeSelfStart, "alignItems", "align-items", "", "safe self-start");
var alignItemsUnsafeFlexStart = document.getElementById("alignItemsUnsafeFlexStart");
checkValues(alignItemsUnsafeFlexStart, "alignItems", "align-items", "", "unsafe flex-start");
var alignItemsSafeFlexEnd = document.getElementById("alignItemsSafeFlexEnd");
checkValues(alignItemsSafeFlexEnd, "alignItems", "align-items", "", "safe flex-end");
}, "Test getting align-items set through CSS.");
test(function() {
element = document.createElement("div");
document.body.appendChild(element);
checkValues(element, "alignItems", "align-items", "", "normal");
}, "Test initial value of align-items through JS");
test(function() {
element = document.createElement("div");
document.body.appendChild(element);
element.style.alignItems = "center";
checkValues(element, "alignItems", "align-items", "center", "center");
element.style.alignItems = "unsafe start";
checkValues(element, "alignItems", "align-items", "unsafe start", "unsafe start");
element.style.alignItems = "safe flex-end";
checkValues(element, "alignItems", "align-items", "safe flex-end", "safe flex-end");
element.style.alignItems = "center";
checkValues(element, "alignItems", "align-items", "center", "center");
element.style.alignItems = "self-start";
checkValues(element, "alignItems", "align-items", "self-start", "self-start");
element.style.alignItems = "normal";
checkValues(element, "alignItems", "align-items", "normal", "normal");
// The 'auto' value is not valid for the align-items property.
element.style.alignItems = "";
element.style.alignItems = "auto";
checkValues(element, "alignItems", "align-items", "", "normal");
element.style.display = "flex";
element.style.alignItems = "auto";
checkValues(element, "alignItems", "align-items", "", "normal");
element.style.display = "grid";
element.style.alignItems = "auto";
checkValues(element, "alignItems", "align-items", "", "normal");
element.style.alignItems = "self-end";
checkValues(element, "alignItems", "align-items", "self-end", "self-end");
}, "Test getting and setting align-items through JS");
test(function() {
element = document.createElement("div");
document.body.appendChild(element);
checkBadValues(element, "alignItems", "align-items", "auto");
checkBadValues(element, "alignItems", "align-items", "left");
checkBadValues(element, "alignItems", "align-items", "right");
checkBadValues(element, "alignItems", "align-items", "unsafe auto");
checkBadValues(element, "alignItems", "align-items", "auto safe");
checkBadValues(element, "alignItems", "align-items", "auto left");
checkBadValues(element, "alignItems", "align-items", "safe left");
checkBadValues(element, "alignItems", "align-items", "unsafe right");
checkBadValues(element, "alignItems", "align-items", "unsafe normal");
checkBadValues(element, "alignItems", "align-items", "normal stretch");
checkBadValues(element, "alignItems", "align-items", "baseline normal");
checkBadValues(element, "alignItems", "align-items", "baseline safe");
checkBadValues(element, "alignItems", "align-items", "baseline center");
checkBadValues(element, "alignItems", "align-items", "first baseline center");
checkBadValues(element, "alignItems", "align-items", "last baseline center");
checkBadValues(element, "alignItems", "align-items", "baseline last");
checkBadValues(element, "alignItems", "align-items", "baseline first");
checkBadValues(element, "alignItems", "align-items", "stretch unsafe");
checkBadValues(element, "alignItems", "align-items", "stretch right");
checkBadValues(element, "alignItems", "align-items", "unsafe unsafe");
checkBadValues(element, "alignItems", "align-items", "unsafe safe");
checkBadValues(element, "alignItems", "align-items", "center start");
checkBadValues(element, "alignItems", "align-items", "stretch unsafe");
checkBadValues(element, "alignItems", "align-items", "safe stretch");
checkBadValues(element, "alignItems", "align-items", "baseline safe");
checkBadValues(element, "alignItems", "align-items", "unsafe baseline");
checkBadValues(element, "alignItems", "align-items", "unsafe safe left");
checkBadValues(element, "alignItems", "align-items", "unsafe left safe");
checkBadValues(element, "alignItems", "align-items", "left safe unsafe safe");
checkBadValues(element, "alignItems", "align-items", "legacy start");
checkBadValues(element, "alignItems", "align-items", "legacy end");
checkBadValues(element, "alignItems", "align-items", "legacy right unsafe");
checkBadValues(element, "alignItems", "align-items", "legacy auto");
checkBadValues(element, "alignItems", "align-items", "legacy stretch");
checkBadValues(element, "alignItems", "align-items", "legacy");
checkBadValues(element, "alignItems", "align-items", "legacy left right");
checkBadValues(element, "alignItems", "align-items", "start safe");
checkBadValues(element, "alignItems", "align-items", "end unsafe");
}, "Test bad combinations of align-items");
test(function() {
element.style.display = "";
checkInitialValues(element, "alignItems", "align-items", "center", "normal");
}, "Test the value 'initial'");
test(function() {
element.style.display = "grid";
checkInitialValues(element, "alignItems", "align-items", "safe start", "normal");
}, "Test the value 'initial' for grid containers");
test(function() {
element.style.display = "flex";
checkInitialValues(element, "alignItems", "align-items", "unsafe end", "normal");
}, "Test the value 'initial' for flex containers");
test(function() {
checkInheritValues("alignItems", "align-items", "end");
checkInheritValues("alignItems", "align-items", "safe start");
checkInheritValues("alignItems", "align-items", "unsafe center");
}, "Test the value 'inherit'");
</script>