OLD | NEW |
1 <!DOCTYPE html> | 1 <!DOCTYPE html> |
2 <html> | 2 <html> |
3 <head> | 3 <head> |
4 <style> | 4 <style> |
5 #justifySelfBaseline { | 5 #justifySelfBaseline { |
6 justify-self: baseline; | 6 justify-self: baseline; |
7 } | 7 } |
8 | 8 |
| 9 #justifySelfLastBaseline { |
| 10 justify-self: last-baseline; |
| 11 } |
| 12 |
9 #justifySelfStretch { | 13 #justifySelfStretch { |
10 justify-self: stretch; | 14 justify-self: stretch; |
11 } | 15 } |
12 | 16 |
13 #justifySelfStart { | 17 #justifySelfStart { |
14 justify-self: start; | 18 justify-self: start; |
15 } | 19 } |
16 | 20 |
17 #justifySelfEnd { | 21 #justifySelfEnd { |
18 justify-self: end; | 22 justify-self: end; |
(...skipping 12 matching lines...) Expand all Loading... |
31 } | 35 } |
32 | 36 |
33 #justifySelfLeft { | 37 #justifySelfLeft { |
34 justify-self: left; | 38 justify-self: left; |
35 } | 39 } |
36 | 40 |
37 #justifySelfRight { | 41 #justifySelfRight { |
38 justify-self: right; | 42 justify-self: right; |
39 } | 43 } |
40 | 44 |
| 45 #justifySelfFlexStart { |
| 46 justify-self: flex-start; |
| 47 } |
| 48 |
| 49 #justifySelfFlexEnd { |
| 50 justify-self: flex-end; |
| 51 } |
| 52 |
41 #justifySelfEndTrue { | 53 #justifySelfEndTrue { |
42 justify-self: end true; | 54 justify-self: end true; |
43 } | 55 } |
44 | 56 |
45 #justifySelfCenterTrue { | 57 #justifySelfCenterTrue { |
46 justify-self: center true; | 58 justify-self: center true; |
47 } | 59 } |
48 | 60 |
49 #justifySelfSelfEndSafe { | 61 #justifySelfSelfEndSafe { |
50 justify-self: self-end safe; | 62 justify-self: self-end safe; |
51 } | 63 } |
52 | 64 |
53 #justifySelfSelfStartSafe { | 65 #justifySelfSelfStartSafe { |
54 justify-self: self-start safe; | 66 justify-self: self-start safe; |
55 } | 67 } |
56 | 68 |
57 #justifySelfRightSafe { | 69 #justifySelfRightSafe { |
58 justify-self: right safe; | 70 justify-self: right safe; |
59 } | 71 } |
60 | 72 |
61 #justifySelfLeftTrue { | 73 #justifySelfLeftTrue { |
62 justify-self: left true; | 74 justify-self: left true; |
63 } | 75 } |
| 76 |
| 77 #justifySelfFlexStartTrue { |
| 78 justify-self: flex-start true; |
| 79 } |
| 80 |
| 81 #justifySelfFlexEndSafe { |
| 82 justify-self: flex-end safe; |
| 83 } |
64 </style> | 84 </style> |
65 <script src="../../resources/js-test.js"></script> | 85 <script src="../../resources/js-test.js"></script> |
66 </head> | 86 </head> |
67 <body> | 87 <body> |
68 <div id="justifySelfBaseline"></div> | 88 <div id="justifySelfBaseline"></div> |
| 89 <div id="justifySelfLastBaseline"></div> |
69 <div id="justifySelfStretch"></div> | 90 <div id="justifySelfStretch"></div> |
70 <div id="justifySelfStart"></div> | 91 <div id="justifySelfStart"></div> |
71 <div id="justifySelfEnd"></div> | 92 <div id="justifySelfEnd"></div> |
72 <div id="justifySelfCenter"></div> | 93 <div id="justifySelfCenter"></div> |
73 <div id="justifySelfSelfStart"></div> | 94 <div id="justifySelfSelfStart"></div> |
74 <div id="justifySelfSelfEnd"></div> | 95 <div id="justifySelfSelfEnd"></div> |
75 <div id="justifySelfLeft"></div> | 96 <div id="justifySelfLeft"></div> |
76 <div id="justifySelfRight"></div> | 97 <div id="justifySelfRight"></div> |
| 98 <div id="justifySelfFlexStart"></div> |
| 99 <div id="justifySelfFlexEnd"></div> |
77 | 100 |
78 <div id="justifySelfEndTrue"></div> | 101 <div id="justifySelfEndTrue"></div> |
79 <div id="justifySelfCenterTrue"></div> | 102 <div id="justifySelfCenterTrue"></div> |
80 <div id="justifySelfSelfEndSafe"></div> | 103 <div id="justifySelfSelfEndSafe"></div> |
81 <div id="justifySelfSelfStartSafe"></div> | 104 <div id="justifySelfSelfStartSafe"></div> |
82 <div id="justifySelfRightSafe"></div> | 105 <div id="justifySelfRightSafe"></div> |
83 <div id="justifySelfLeftTrue"></div> | 106 <div id="justifySelfLeftTrue"></div> |
| 107 <div id="justifySelfFlexStartTrue"></div> |
| 108 <div id="justifySelfFlexEndSafe"></div> |
| 109 <script src="resources/alignment-parsing-utils.js"></script> |
84 <script> | 110 <script> |
85 description('Test that setting and getting justify-self works as expected'); | 111 description('Test that setting and getting justify-self works as expected'); |
86 | 112 |
87 debug("Test getting justify-self set through CSS"); | 113 debug("Test getting justify-self set through CSS"); |
88 var justifySelfBaseline = document.getElementById("justifySelfBaseline"); | 114 var justifySelfBaseline = document.getElementById("justifySelfBaseline"); |
89 shouldBe("getComputedStyle(justifySelfBaseline, '').getPropertyValue('justify-se
lf')", "'baseline'"); | 115 shouldBe("getComputedStyle(justifySelfBaseline, '').getPropertyValue('justify-se
lf')", "'baseline'"); |
90 | 116 |
| 117 var justifySelfLastBaseline = document.getElementById("justifySelfLastBaseline")
; |
| 118 shouldBe("getComputedStyle(justifySelfLastBaseline, '').getPropertyValue('justif
y-self')", "'last-baseline'"); |
| 119 |
91 var justifySelfStretch = document.getElementById("justifySelfStretch"); | 120 var justifySelfStretch = document.getElementById("justifySelfStretch"); |
92 shouldBe("getComputedStyle(justifySelfStretch, '').getPropertyValue('justify-sel
f')", "'stretch'"); | 121 shouldBe("getComputedStyle(justifySelfStretch, '').getPropertyValue('justify-sel
f')", "'stretch'"); |
93 | 122 |
94 var justifySelfStart = document.getElementById("justifySelfStart"); | 123 var justifySelfStart = document.getElementById("justifySelfStart"); |
95 shouldBe("getComputedStyle(justifySelfStart, '').getPropertyValue('justify-self'
)", "'start'"); | 124 shouldBe("getComputedStyle(justifySelfStart, '').getPropertyValue('justify-self'
)", "'start'"); |
96 | 125 |
97 var justifySelfEnd = document.getElementById("justifySelfEnd"); | 126 var justifySelfEnd = document.getElementById("justifySelfEnd"); |
98 shouldBe("getComputedStyle(justifySelfEnd, '').getPropertyValue('justify-self')"
, "'end'"); | 127 shouldBe("getComputedStyle(justifySelfEnd, '').getPropertyValue('justify-self')"
, "'end'"); |
99 | 128 |
100 var justifySelfCenter = document.getElementById("justifySelfCenter"); | 129 var justifySelfCenter = document.getElementById("justifySelfCenter"); |
101 shouldBe("getComputedStyle(justifySelfCenter, '').getPropertyValue('justify-self
')", "'center'"); | 130 shouldBe("getComputedStyle(justifySelfCenter, '').getPropertyValue('justify-self
')", "'center'"); |
102 | 131 |
103 var justifySelfSelfEnd = document.getElementById("justifySelfSelfEnd"); | 132 var justifySelfSelfEnd = document.getElementById("justifySelfSelfEnd"); |
104 shouldBe("getComputedStyle(justifySelfSelfEnd, '').getPropertyValue('justify-sel
f')", "'self-end'"); | 133 shouldBe("getComputedStyle(justifySelfSelfEnd, '').getPropertyValue('justify-sel
f')", "'self-end'"); |
105 | 134 |
106 var justifySelfSelfStart = document.getElementById("justifySelfSelfStart"); | 135 var justifySelfSelfStart = document.getElementById("justifySelfSelfStart"); |
107 shouldBe("getComputedStyle(justifySelfSelfStart, '').getPropertyValue('justify-s
elf')", "'self-start'"); | 136 shouldBe("getComputedStyle(justifySelfSelfStart, '').getPropertyValue('justify-s
elf')", "'self-start'"); |
108 | 137 |
109 var justifySelfLeft = document.getElementById("justifySelfLeft"); | 138 var justifySelfLeft = document.getElementById("justifySelfLeft"); |
110 shouldBe("getComputedStyle(justifySelfLeft, '').getPropertyValue('justify-self')
", "'left'"); | 139 shouldBe("getComputedStyle(justifySelfLeft, '').getPropertyValue('justify-self')
", "'left'"); |
111 | 140 |
112 var justifySelfRight = document.getElementById("justifySelfRight"); | 141 var justifySelfRight = document.getElementById("justifySelfRight"); |
113 shouldBe("getComputedStyle(justifySelfRight, '').getPropertyValue('justify-self'
)", "'right'"); | 142 shouldBe("getComputedStyle(justifySelfRight, '').getPropertyValue('justify-self'
)", "'right'"); |
114 | 143 |
| 144 var justifySelfFlexStart = document.getElementById("justifySelfFlexStart"); |
| 145 shouldBe("getComputedStyle(justifySelfFlexStart, '').getPropertyValue('justify-s
elf')", "'flex-start'"); |
| 146 |
| 147 var justifySelfFlexEnd = document.getElementById("justifySelfFlexEnd"); |
| 148 shouldBe("getComputedStyle(justifySelfFlexEnd, '').getPropertyValue('justify-sel
f')", "'flex-end'"); |
| 149 |
115 var justifySelfEndTrue = document.getElementById("justifySelfEndTrue"); | 150 var justifySelfEndTrue = document.getElementById("justifySelfEndTrue"); |
116 shouldBe("getComputedStyle(justifySelfEndTrue, '').getPropertyValue('justify-sel
f')", "'end true'"); | 151 shouldBe("getComputedStyle(justifySelfEndTrue, '').getPropertyValue('justify-sel
f')", "'end true'"); |
117 | 152 |
118 var justifySelfCenterTrue = document.getElementById("justifySelfCenterTrue"); | 153 var justifySelfCenterTrue = document.getElementById("justifySelfCenterTrue"); |
119 shouldBe("getComputedStyle(justifySelfCenterTrue, '').getPropertyValue('justify-
self')", "'center true'"); | 154 shouldBe("getComputedStyle(justifySelfCenterTrue, '').getPropertyValue('justify-
self')", "'center true'"); |
120 | 155 |
121 var justifySelfSelfEndSafe = document.getElementById("justifySelfSelfEndSafe"); | 156 var justifySelfSelfEndSafe = document.getElementById("justifySelfSelfEndSafe"); |
122 shouldBe("getComputedStyle(justifySelfSelfEndSafe, '').getPropertyValue('justify
-self')", "'self-end safe'"); | 157 shouldBe("getComputedStyle(justifySelfSelfEndSafe, '').getPropertyValue('justify
-self')", "'self-end safe'"); |
123 | 158 |
124 var justifySelfSelfStartSafe = document.getElementById("justifySelfSelfStartSafe
"); | 159 var justifySelfSelfStartSafe = document.getElementById("justifySelfSelfStartSafe
"); |
125 shouldBe("getComputedStyle(justifySelfSelfStartSafe, '').getPropertyValue('justi
fy-self')", "'self-start safe'"); | 160 shouldBe("getComputedStyle(justifySelfSelfStartSafe, '').getPropertyValue('justi
fy-self')", "'self-start safe'"); |
126 | 161 |
127 var justifySelfRightSafe = document.getElementById("justifySelfRightSafe"); | 162 var justifySelfRightSafe = document.getElementById("justifySelfRightSafe"); |
128 shouldBe("getComputedStyle(justifySelfRightSafe, '').getPropertyValue('justify-s
elf')", "'right safe'"); | 163 shouldBe("getComputedStyle(justifySelfRightSafe, '').getPropertyValue('justify-s
elf')", "'right safe'"); |
129 | 164 |
130 var justifySelfLeftTrue = document.getElementById("justifySelfLeftTrue"); | 165 var justifySelfLeftTrue = document.getElementById("justifySelfLeftTrue"); |
131 shouldBe("getComputedStyle(justifySelfLeftTrue, '').getPropertyValue('justify-se
lf')", "'left true'"); | 166 shouldBe("getComputedStyle(justifySelfLeftTrue, '').getPropertyValue('justify-se
lf')", "'left true'"); |
132 | 167 |
| 168 var justifySelfFlexStartTrue = document.getElementById("justifySelfFlexStartTrue
"); |
| 169 shouldBe("getComputedStyle(justifySelfFlexStartTrue, '').getPropertyValue('justi
fy-self')", "'flex-start true'"); |
| 170 |
| 171 var justifySelfFlexEndSafe = document.getElementById("justifySelfFlexEndSafe"); |
| 172 shouldBe("getComputedStyle(justifySelfFlexEndSafe, '').getPropertyValue('justify
-self')", "'flex-end safe'"); |
| 173 |
133 debug(""); | 174 debug(""); |
134 debug("Test initial value of justify-self through JS"); | 175 debug("Test initial value of justify-self through JS"); |
135 element = document.createElement("div"); | 176 element = document.createElement("div"); |
136 document.body.appendChild(element); | 177 document.body.appendChild(element); |
137 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 178 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'sta
rt'"); |
138 | 179 |
139 debug(""); | 180 debug(""); |
140 debug("Test getting and setting justify-self through JS"); | 181 debug("Test getting and setting justify-self through JS"); |
| 182 container = document.createElement("div"); |
141 element = document.createElement("div"); | 183 element = document.createElement("div"); |
142 document.body.appendChild(element); | 184 container.appendChild(element); |
| 185 document.body.appendChild(container); |
143 element.style.justifySelf = "center"; | 186 element.style.justifySelf = "center"; |
144 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'cen
ter'"); | 187 checkValues(element, "justifySelf", "justify-self", "center", "center"); |
145 | 188 |
146 element = document.createElement("div"); | |
147 document.body.appendChild(element); | |
148 element.style.justifySelf = "true start"; | 189 element.style.justifySelf = "true start"; |
149 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'sta
rt true'"); | 190 checkValues(element, "justifySelf", "justify-self", "start true", "start true")
; |
| 191 |
| 192 element.style.justifySelf = "flex-end safe"; |
| 193 checkValues(element, "justifySelf", "justify-self", "flex-end safe", "flex-end
safe"); |
| 194 |
| 195 element.style.justifySelf = "right"; |
| 196 checkValues(element, "justifySelf", "justify-self", "right", "right"); |
| 197 |
| 198 element.style.justifySelf = "center"; |
| 199 checkValues(element, "justifySelf", "justify-self", "center", "center"); |
| 200 |
| 201 element.style.justifySelf = "self-start"; |
| 202 checkValues(element, "justifySelf", "justify-self", "self-start", "self-start")
; |
150 | 203 |
151 element.style.justifySelf = "auto"; | 204 element.style.justifySelf = "auto"; |
152 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 205 checkValues(element, "justifySelf", "justify-self", "auto", "start"); |
| 206 |
| 207 container.style.display = "flex"; |
| 208 element.style.justifySelf = "auto"; |
| 209 checkValues(element, "justifySelf", "justify-self", "auto", "stretch"); |
| 210 |
| 211 container.style.display = "grid"; |
| 212 element.style.justifySelf = "auto"; |
| 213 checkValues(element, "justifySelf", "justify-self", "auto", "stretch"); |
| 214 |
| 215 element.style.justifySelf = "self-end"; |
| 216 checkValues(element, "justifySelf", "justify-self", "self-end", "self-end"); |
153 | 217 |
154 debug(""); | 218 debug(""); |
155 debug("Test bad combinaisons of justify-self"); | 219 debug("Test bad combinations of justify-self"); |
| 220 container = document.createElement("div"); |
156 element = document.createElement("div"); | 221 element = document.createElement("div"); |
157 document.body.appendChild(element); | 222 container.appendChild(element); |
158 element.style.justifySelf = "true auto"; | 223 document.body.appendChild(container); |
159 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
160 | 224 |
161 element.style.justifySelf = "auto safe"; | 225 checkBadValues(element, "justifySelf", "justify-self", "true auto"); |
162 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 226 checkBadValues(element, "justifySelf", "justify-self", "auto safe"); |
163 | 227 checkBadValues(element, "justifySelf", "justify-self", "auto left"); |
164 element.style.justifySelf = "auto left"; | 228 checkBadValues(element, "justifySelf", "justify-self", "baseline safe"); |
165 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 229 checkBadValues(element, "justifySelf", "justify-self", "baseline center"); |
166 | 230 checkBadValues(element, "justifySelf", "justify-self", "stretch true"); |
167 element.style.justifySelf = "baseline safe"; | 231 checkBadValues(element, "justifySelf", "justify-self", "stretch right"); |
168 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 232 checkBadValues(element, "justifySelf", "justify-self", "true true"); |
169 | 233 checkBadValues(element, "justifySelf", "justify-self", "true safe"); |
170 element.style.justifySelf = "baseline center"; | 234 checkBadValues(element, "justifySelf", "justify-self", "center start"); |
171 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 235 checkBadValues(element, "justifySelf", "justify-self", "stretch true"); |
172 | 236 checkBadValues(element, "justifySelf", "justify-self", "safe stretch"); |
173 element.style.justifySelf = "stretch true"; | 237 checkBadValues(element, "justifySelf", "justify-self", "baseline safe"); |
174 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 238 checkBadValues(element, "justifySelf", "justify-self", "true baseline"); |
175 | 239 checkBadValues(element, "justifySelf", "justify-self", "true safe left"); |
176 element.style.justifySelf = "stretch right"; | 240 checkBadValues(element, "justifySelf", "justify-self", "true left safe"); |
177 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 241 checkBadValues(element, "justifySelf", "justify-self", "left safe true safe"); |
178 | 242 checkBadValues(element, "justifySelf", "justify-self", "legacy start"); |
179 element.style.justifySelf = "true true"; | 243 checkBadValues(element, "justifySelf", "justify-self", "legacy end"); |
180 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 244 checkBadValues(element, "justifySelf", "justify-self", "legacy right true"); |
181 | 245 checkBadValues(element, "justifySelf", "justify-self", "legacy auto"); |
182 element.style.justifySelf = "true"; | 246 checkBadValues(element, "justifySelf", "justify-self", "legacy stretch"); |
183 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 247 checkBadValues(element, "justifySelf", "justify-self", "legacy"); |
184 | 248 checkBadValues(element, "justifySelf", "justify-self", "legacy left right"); |
185 element.style.justifySelf = "true safe"; | |
186 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
187 | |
188 element.style.justifySelf = "center start"; | |
189 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
190 | |
191 element.style.justifySelf = "stretch true"; | |
192 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
193 | |
194 element.style.justifySelf = "safe stretch"; | |
195 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
196 | |
197 element.style.justifySelf = "baseline safe"; | |
198 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
199 | |
200 element.style.justifySelf = "true baseline"; | |
201 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
202 | |
203 element.style.justifySelf = "true safe"; | |
204 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
205 | |
206 element.style.justifySelf = "true safe left"; | |
207 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
208 | |
209 element.style.justifySelf = "true left safe"; | |
210 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
211 | |
212 element.style.justifySelf = "left safe true safe"; | |
213 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | |
214 | 249 |
215 debug(""); | 250 debug(""); |
216 debug("Test the value 'initial'"); | 251 debug("Test the value 'initial'"); |
217 element.style.justifySelf = "center"; | 252 checkInitialValues(element, "justifySelf", "justify-self", "", "center"); |
218 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'cen
ter'"); | 253 |
219 element.style.justifySelf = "initial"; | 254 debug(""); |
220 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'aut
o'"); | 255 debug("Test the value 'initial' for grid containers"); |
| 256 container.style.display = "grid"; |
| 257 checkInitialValues(element, "justifySelf", "justify-self", "grid", "left safe"); |
| 258 |
| 259 debug(""); |
| 260 debug("Test the value 'initial' for flex containers"); |
| 261 container.style.display = "flex"; |
| 262 checkInitialValues(element, "justifySelf", "justify-self", "flex", "right true")
; |
221 | 263 |
222 debug(""); | 264 debug(""); |
223 debug("Test the value 'inherit'"); | 265 debug("Test the value 'inherit'"); |
224 parentElement = document.createElement("div"); | 266 checkInheritValues(element, "justifySelf", "justify-self", "end"); |
225 document.body.appendChild(parentElement); | 267 checkInheritValues(element, "justifySelf", "justify-self", "left safe"); |
226 parentElement.style.justifySelf = "end"; | 268 checkInheritValues(element, "justifySelf", "justify-self", "center true"); |
227 shouldBe("getComputedStyle(parentElement, '').getPropertyValue('justify-self')",
"'end'"); | |
228 | 269 |
229 element = document.createElement("div"); | |
230 parentElement.appendChild(element); | |
231 element.style.justifySelf = "inherit"; | |
232 shouldBe("getComputedStyle(element, '').getPropertyValue('justify-self')", "'end
'"); | |
233 </script> | 270 </script> |
234 </body> | 271 </body> |
235 </html> | 272 </html> |
OLD | NEW |