Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(104)

Side by Side Diff: LayoutTests/fast/alignment/parse-justify-items.html

Issue 333423005: [CSS Grid Layout] Implement 'justify-items' parsing (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Patch rebased. Created 6 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 <!DOCTYPE html>
2 <html>
3 <head>
4 <style>
5 #justifyItemsBaseline {
6 justify-items: baseline;
7 }
8
9 #justifyItemsLastBaseline {
10 justify-items: last-baseline;
11 }
12
13 #justifyItemsStretch {
14 justify-items: stretch;
15 }
16
17 #justifyItemsStart {
18 justify-items: start;
19 }
20
21 #justifyItemsEnd {
22 justify-items: end;
23 }
24
25 #justifyItemsCenter {
26 justify-items: center;
27 }
28
29 #justifyItemsSelfStart {
30 justify-items: self-start;
31 }
32
33 #justifyItemsSelfEnd {
34 justify-items: self-end;
35 }
36
37 #justifyItemsLeft {
38 justify-items: left;
39 }
40
41 #justifyItemsRight {
42 justify-items: right;
43 }
44
45 #justifyItemsFlexStart {
46 justify-items: flex-start;
47 }
48
49 #justifyItemsFlexEnd {
50 justify-items: flex-end;
51 }
52
53 #justifyItemsEndTrue {
54 justify-items: end true;
55 }
56
57 #justifyItemsCenterTrue {
58 justify-items: center true;
59 }
60
61 #justifyItemsSelfEndSafe {
62 justify-items: self-end safe;
63 }
64
65 #justifyItemsSelfStartSafe {
66 justify-items: self-start safe;
67 }
68
69 #justifyItemsRightSafe {
70 justify-items: right safe;
71 }
72
73 #justifyItemsLeftTrue {
74 justify-items: left true;
75 }
76
77 #justifyItemsFlexStartTrue {
78 justify-items: flex-start true;
79 }
80
81 #justifyItemsFlexEndSafe {
82 justify-items: flex-end safe;
83 }
84
85 #justifyItemsLegacyLeft {
86 justify-items: legacy left;
87 }
88
89 #justifyItemsLegacyCenter {
90 justify-items: legacy center;
91 }
92
93 #justifyItemsLegacyRight {
94 justify-items: legacy right;
95 }
96
97 #justifyItemsLeftLegacy {
98 justify-items: left legacy;
99 }
100
101 #justifyItemsCenterLegacy {
102 justify-items: center legacy;
103 }
104
105 #justifyItemsRightLegacy {
106 justify-items: right legacy;
107 }
108 </style>
109 <script src="../../resources/js-test.js"></script>
110 </head>
111 <body>
112 <div id="justifyItemsBaseline"></div>
113 <div id="justifyItemsLastBaseline"></div>
114 <div id="justifyItemsStretch"></div>
115 <div id="justifyItemsStart"></div>
116 <div id="justifyItemsEnd"></div>
117 <div id="justifyItemsCenter"></div>
118 <div id="justifyItemsSelfStart"></div>
119 <div id="justifyItemsSelfEnd"></div>
120 <div id="justifyItemsLeft"></div>
121 <div id="justifyItemsRight"></div>
122 <div id="justifyItemsFlexStart"></div>
123 <div id="justifyItemsFlexEnd"></div>
124
125 <div id="justifyItemsEndTrue"></div>
126 <div id="justifyItemsCenterTrue"></div>
127 <div id="justifyItemsSelfEndSafe"></div>
128 <div id="justifyItemsSelfStartSafe"></div>
129 <div id="justifyItemsRightSafe"></div>
130 <div id="justifyItemsLeftTrue"></div>
131 <div id="justifyItemsFlexStartTrue"></div>
132 <div id="justifyItemsFlexEndSafe"></div>
133 <div id="justifyItemsLegacyLeft"></div>
134 <div id="justifyItemsLegacyCenter"></div>
135 <div id="justifyItemsLegacyRight"></div>
136 <div id="justifyItemsLeftLegacy"></div>
137 <div id="justifyItemsCenterLegacy"></div>
138 <div id="justifyItemsRightLegacy"></div>
139 <script src="resources/alignment-parsing-utils.js"></script>
140 <script>
141 description('Test that setting and getting justify-items works as expected');
142
143 debug("Test getting justify-items set through CSS");
144 var justifyItemsBaseline = document.getElementById("justifyItemsBaseline");
145 shouldBe("getComputedStyle(justifyItemsBaseline, '').getPropertyValue('justify-i tems')", "'baseline'");
146
147 var justifyItemsLastBaseline = document.getElementById("justifyItemsLastBaseline ");
148 shouldBe("getComputedStyle(justifyItemsLastBaseline, '').getPropertyValue('justi fy-items')", "'last-baseline'");
149
150 var justifyItemsStretch = document.getElementById("justifyItemsStretch");
151 shouldBe("getComputedStyle(justifyItemsStretch, '').getPropertyValue('justify-it ems')", "'stretch'");
152
153 var justifyItemsStart = document.getElementById("justifyItemsStart");
154 shouldBe("getComputedStyle(justifyItemsStart, '').getPropertyValue('justify-item s')", "'start'");
155
156 var justifyItemsEnd = document.getElementById("justifyItemsEnd");
157 shouldBe("getComputedStyle(justifyItemsEnd, '').getPropertyValue('justify-items' )", "'end'");
158
159 var justifyItemsCenter = document.getElementById("justifyItemsCenter");
160 shouldBe("getComputedStyle(justifyItemsCenter, '').getPropertyValue('justify-ite ms')", "'center'");
161
162 var justifyItemsSelfEnd = document.getElementById("justifyItemsSelfEnd");
163 shouldBe("getComputedStyle(justifyItemsSelfEnd, '').getPropertyValue('justify-it ems')", "'self-end'");
164
165 var justifyItemsSelfStart = document.getElementById("justifyItemsSelfStart");
166 shouldBe("getComputedStyle(justifyItemsSelfStart, '').getPropertyValue('justify- items')", "'self-start'");
167
168 var justifyItemsLeft = document.getElementById("justifyItemsLeft");
169 shouldBe("getComputedStyle(justifyItemsLeft, '').getPropertyValue('justify-items ')", "'left'");
170
171 var justifyItemsRight = document.getElementById("justifyItemsRight");
172 shouldBe("getComputedStyle(justifyItemsRight, '').getPropertyValue('justify-item s')", "'right'");
173
174 var justifyItemsFlexStart = document.getElementById("justifyItemsFlexStart");
175 shouldBe("getComputedStyle(justifyItemsFlexStart, '').getPropertyValue('justify- items')", "'flex-start'");
176
177 var justifyItemsFlexEnd = document.getElementById("justifyItemsFlexEnd");
178 shouldBe("getComputedStyle(justifyItemsFlexEnd, '').getPropertyValue('justify-it ems')", "'flex-end'");
179
180 var justifyItemsEndTrue = document.getElementById("justifyItemsEndTrue");
181 shouldBe("getComputedStyle(justifyItemsEndTrue, '').getPropertyValue('justify-it ems')", "'end true'");
182
183 var justifyItemsCenterTrue = document.getElementById("justifyItemsCenterTrue");
184 shouldBe("getComputedStyle(justifyItemsCenterTrue, '').getPropertyValue('justify -items')", "'center true'");
185
186 var justifyItemsSelfEndSafe = document.getElementById("justifyItemsSelfEndSafe") ;
187 shouldBe("getComputedStyle(justifyItemsSelfEndSafe, '').getPropertyValue('justif y-items')", "'self-end safe'");
188
189 var justifyItemsSelfStartSafe = document.getElementById("justifyItemsSelfStartSa fe");
190 shouldBe("getComputedStyle(justifyItemsSelfStartSafe, '').getPropertyValue('just ify-items')", "'self-start safe'");
191
192 var justifyItemsRightSafe = document.getElementById("justifyItemsRightSafe");
193 shouldBe("getComputedStyle(justifyItemsRightSafe, '').getPropertyValue('justify- items')", "'right safe'");
194
195 var justifyItemsLeftTrue = document.getElementById("justifyItemsLeftTrue");
196 shouldBe("getComputedStyle(justifyItemsLeftTrue, '').getPropertyValue('justify-i tems')", "'left true'");
197
198 var justifyItemsFlexStartTrue = document.getElementById("justifyItemsFlexStartTr ue");
199 shouldBe("getComputedStyle(justifyItemsFlexStartTrue, '').getPropertyValue('just ify-items')", "'flex-start true'");
200
201 var justifyItemsFlexEndSafe = document.getElementById("justifyItemsFlexEndSafe") ;
202 shouldBe("getComputedStyle(justifyItemsFlexEndSafe, '').getPropertyValue('justif y-items')", "'flex-end safe'");
203
204 var justifyItemsLegacyLeft = document.getElementById("justifyItemsLegacyLeft");
205 shouldBe("getComputedStyle(justifyItemsLegacyLeft, '').getPropertyValue('justify -items')", "'legacy left'");
206
207 var justifyItemsLegacyCenter = document.getElementById("justifyItemsLegacyCenter ");
208 shouldBe("getComputedStyle(justifyItemsLegacyCenter, '').getPropertyValue('justi fy-items')", "'legacy center'");
209
210 var justifyItemsLegacyRight = document.getElementById("justifyItemsLegacyRight") ;
211 shouldBe("getComputedStyle(justifyItemsLegacyRight, '').getPropertyValue('justif y-items')", "'legacy right'");
212
213 var justifyItemsLeftLegacy = document.getElementById("justifyItemsLeftLegacy");
214 shouldBe("getComputedStyle(justifyItemsLeftLegacy, '').getPropertyValue('justify -items')", "'legacy left'");
215
216 var justifyItemsCenterLegacy = document.getElementById("justifyItemsCenterLegacy ");
217 shouldBe("getComputedStyle(justifyItemsCenterLegacy, '').getPropertyValue('justi fy-items')", "'legacy center'");
218
219 var justifyItemsRightLegacy = document.getElementById("justifyItemsRightLegacy") ;
220 shouldBe("getComputedStyle(justifyItemsRightLegacy, '').getPropertyValue('justif y-items')", "'legacy right'");
221
222 debug("");
223 debug("Test initial value of justify-items through JS");
224 element = document.createElement("div");
225 document.body.appendChild(element);
226 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-items')", "'st art'");
227
228 debug("");
229 debug("Test getting and setting justify-items through JS");
230 element = document.createElement("div");
231 document.body.appendChild(element);
232 element.style.justifyItems = "center";
233 checkValues(element, "justifyItems", "justify-items", "center", "center");
234
235 element.style.justifyItems = "true start";
236 checkValues(element, "justifyItems", "justify-items", "start true", "start true ");
237
238 element.style.justifyItems = "flex-end safe";
239 checkValues(element, "justifyItems", "justify-items", "flex-end safe", "flex-en d safe");
240
241 element.style.justifyItems = "right legacy";
242 checkValues(element, "justifyItems", "justify-items", "legacy right", "legacy r ight");
243
244 element.style.justifyItems = "center legacy";
245 checkValues(element, "justifyItems", "justify-items", "legacy center", "legacy center");
246
247 element.style.justifyItems = "left legacy";
248 checkValues(element, "justifyItems", "justify-items", "legacy left", "legacy le ft");
249
250 element.style.justifyItems = "auto";
251 checkValues(element, "justifyItems", "justify-items", "auto", "start");
252
253 element.style.display = "flex";
254 element.style.justifyItems = "auto";
255 checkValues(element, "justifyItems", "justify-items", "auto", "stretch");
256
257 element.style.display = "grid";
258 element.style.justifyItems = "auto";
259 checkValues(element, "justifyItems", "justify-items", "auto", "stretch");
260 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-items')", "'st retch'");
261 shouldBe("element.style.justifyItems", "'auto'");
262
263 element.style.justifyItems = "self-end";
264 checkValues(element, "justifyItems", "justify-items", "self-end", "self-end");
265
266 debug("");
267 debug("Test bad combinations of justify-items");
268 element = document.createElement("div");
269 document.body.appendChild(element);
270
271 checkBadValues(element, "justifyItems", "justify-items", "true auto");
272 checkBadValues(element, "justifyItems", "justify-items", "auto safe");
273 checkBadValues(element, "justifyItems", "justify-items", "auto left");
274 checkBadValues(element, "justifyItems", "justify-items", "baseline safe");
275 checkBadValues(element, "justifyItems", "justify-items", "baseline center");
276 checkBadValues(element, "justifyItems", "justify-items", "stretch true");
277 checkBadValues(element, "justifyItems", "justify-items", "stretch right");
278 checkBadValues(element, "justifyItems", "justify-items", "true true");
279 checkBadValues(element, "justifyItems", "justify-items", "true safe");
280 checkBadValues(element, "justifyItems", "justify-items", "center start");
281 checkBadValues(element, "justifyItems", "justify-items", "stretch true");
282 checkBadValues(element, "justifyItems", "justify-items", "safe stretch");
283 checkBadValues(element, "justifyItems", "justify-items", "baseline safe");
284 checkBadValues(element, "justifyItems", "justify-items", "true baseline");
285 checkBadValues(element, "justifyItems", "justify-items", "true safe left");
286 checkBadValues(element, "justifyItems", "justify-items", "true left safe");
287 checkBadValues(element, "justifyItems", "justify-items", "left safe true safe") ;
288 checkBadValues(element, "justifyItems", "justify-items", "legacy start");
289 checkBadValues(element, "justifyItems", "justify-items", "legacy end");
290 checkBadValues(element, "justifyItems", "justify-items", "legacy right true");
291 checkBadValues(element, "justifyItems", "justify-items", "legacy auto");
292 checkBadValues(element, "justifyItems", "justify-items", "legacy stretch");
293 checkBadValues(element, "justifyItems", "justify-items", "legacy");
294 checkBadValues(element, "justifyItems", "justify-items", "legacy left right");
295
296 debug("");
297 debug("Test the value 'initial'");
298 checkInitialValues(element, "justifyItems", "justify-items");
299
300 debug("");
301 debug("Test the value 'initial' for grid containers");
302 checkInitialValues(element, "justifyItems", "justify-items", "grid");
303
304 debug("");
305 debug("Test the value 'initial' for flex containers");
306 checkInitialValues(element, "justifyItems", "justify-items", "flex");
307
308 debug("");
309 debug("Test the value 'inherit'");
310 parentElement = document.createElement("div");
311 document.body.appendChild(parentElement);
312 parentElement.style.justifyItems = "end";
313 checkValues(parentElement, "justifyItems", "justify-items", "end", "end");
314
315 element = document.createElement("div");
316 parentElement.appendChild(element);
317 element.style.justifyItems = "inherit";
318 checkValues(element, "justifyItems", "justify-items", "inherit", "end");
319
320 debug("");
321 debug("Test the value 'legacy'");
322 parentElement = document.createElement("div");
323 document.body.appendChild(parentElement);
324 parentElement.style.justifyItems = "legacy right";
325 checkValues(parentElement, "justifyItems", "justify-items", "legacy right", "le gacy right");
326
327 element = document.createElement("div");
328 parentElement.appendChild(element);
329 checkValues(element, "justifyItems", "justify-items", "", "legacy right");
330
331 </script>
332 </body>
333 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698