| OLD | NEW |
| (Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <style> |
| 5 #placeContentNormal { |
| 6 place-content: normal; |
| 7 } |
| 8 #placeContentBaseline { |
| 9 place-content: baseline; |
| 10 } |
| 11 #placeContentStart { |
| 12 place-content: start; |
| 13 } |
| 14 #placeContentFlexStart { |
| 15 place-content: flex-start; |
| 16 } |
| 17 #placeContentEnd { |
| 18 place-content: end; |
| 19 } |
| 20 #placeContentSpaceBetween { |
| 21 place-content: space-between; |
| 22 } |
| 23 #placeContentStretch { |
| 24 place-content: stretch; |
| 25 } |
| 26 #placeContentStartEnd { |
| 27 place-content: start end; |
| 28 } |
| 29 #placeContentStartSpaceEvenly { |
| 30 place-content: start space-evenly; |
| 31 } |
| 32 #placeContentStartBaseline { |
| 33 place-content: start baseline; |
| 34 } |
| 35 |
| 36 <!-- Invalid CSS cases --> |
| 37 #placeContentEmpty { |
| 38 place-content:; |
| 39 } |
| 40 #placeContentAuto { |
| 41 place-content: auto; |
| 42 } |
| 43 #placeContentNone { |
| 44 place-content: none; |
| 45 } |
| 46 #placeContentSafe { |
| 47 place-content: safe; |
| 48 } |
| 49 #placeContentStartSafe { |
| 50 place-content: start safe; |
| 51 } |
| 52 #placeContentStartEndLeft { |
| 53 place-content: start end left; |
| 54 } |
| 55 </style> |
| 56 <script src="../../resources/testharness.js"></script> |
| 57 <script src="../../resources/testharnessreport.js"></script> |
| 58 <script src="resources/alignment-parsing-utils-th.js"></script> |
| 59 </head> |
| 60 <body> |
| 61 <p>Test to verify that the new place-content alignment shorthand is parsed a
s expected and correctly sets the longhand values.</p> |
| 62 <div id="log"></div> |
| 63 |
| 64 <div id="placeContentNormal"></div> |
| 65 <div id="placeContentBaseline"></div> |
| 66 <div id="placeContentStart"></div> |
| 67 <div id="placeContentFlexStart"></div> |
| 68 <div id="placeContentEnd"></div> |
| 69 <div id="placeContentSpaceBetween"></div> |
| 70 <div id="placeContentStretch"></div> |
| 71 <div id="placeContentStartEnd"></div> |
| 72 <div id="placeContentStartSpaceEvenly"></div> |
| 73 <div id="placeContentStartBaseline"></div> |
| 74 |
| 75 <div id="placeContentEmpty"></div> |
| 76 <div id="placeContentAuto"></div> |
| 77 <div id="placeContentNone"></div> |
| 78 <div id="placeContentSafe"></div> |
| 79 <div id="placeContentStartSafe"></div> |
| 80 <div id="placeContentBaselineSafe"></div> |
| 81 <div id="placeContentStartEndLeft"></div> |
| 82 <script> |
| 83 function checkPlaceContentValues(element, value, alignValue, justifyValue) |
| 84 { |
| 85 var res = value.split(" "); |
| 86 if (res.length < 2) |
| 87 res[1] = res[0]; |
| 88 checkValues(element, "alignContent", "align-content", res[0], alignValue); |
| 89 checkValues(element, "justifyContent", "justify-content", res[1], justifyVa
lue); |
| 90 } |
| 91 |
| 92 function checkPlaceContentValuesJS(value, alignValue, justifyValue) |
| 93 { |
| 94 element = document.createElement("div"); |
| 95 document.body.appendChild(element); |
| 96 element.style.placeContent = value; |
| 97 checkValues(element, "placeContent", "place-content", value, alignValue + ' '
+ justifyValue) |
| 98 checkPlaceContentValues(element, value, alignValue, justifyValue) |
| 99 } |
| 100 |
| 101 function checkPlaceContentValuesBadJS(value) |
| 102 { |
| 103 element.style.placeContent = ""; |
| 104 element.style.placeContent = value; |
| 105 checkPlaceContentValues(element, "", "normal", "normal") |
| 106 } |
| 107 |
| 108 function checkPlaceContentInitialValue() |
| 109 { |
| 110 element = document.createElement("div"); |
| 111 document.body.appendChild(element); |
| 112 checkValues(element, "placeContent", "place-content", "", "normal normal"); |
| 113 element.style.placeContent = "center"; |
| 114 checkPlaceContentValues(element, "center", "center", "center"); |
| 115 element.style.placeContent = "initial"; |
| 116 checkValues(element, "placeContent", "place-content", "initial", "normal norm
al"); |
| 117 checkPlaceContentValues(element, "initial", "normal", "normal"); |
| 118 } |
| 119 |
| 120 function checkPlaceContentInheritValue() |
| 121 { |
| 122 document.body.style.placeContent = "start"; |
| 123 var anotherElement = document.createElement("div"); |
| 124 document.body.appendChild(anotherElement); |
| 125 checkPlaceContentValues(anotherElement, "", "normal", "normal"); |
| 126 anotherElement.style.placeContent = "inherit"; |
| 127 checkPlaceContentValues(anotherElement, "inherit", "start", "start"); |
| 128 } |
| 129 |
| 130 |
| 131 test(function() { |
| 132 checkValues(placeContentNormal, "placeContent", "place-content", "", "normal
normal"); |
| 133 checkPlaceContentValues(placeContentNormal, "", "normal", "normal"); |
| 134 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'normal' value through CSS."); |
| 135 |
| 136 test(function() { |
| 137 checkValues(placeContentBaseline, "placeContent", "place-content", "", "base
line baseline"); |
| 138 checkPlaceContentValues(placeContentBaseline, "", "baseline", "baseline"); |
| 139 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'baseline' value through CSS."); |
| 140 |
| 141 test(function() { |
| 142 checkValues(placeContentStart, "placeContent", "place-content", "", "start s
tart"); |
| 143 checkPlaceContentValues(placeContentStart, "", "start", "start"); |
| 144 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'start' value through CSS."); |
| 145 |
| 146 test(function() { |
| 147 checkValues(placeContentFlexStart, "placeContent", "place-content", "", "fle
x-start flex-start"); |
| 148 checkPlaceContentValues(placeContentFlexStart, "", "flex-start", "flex-start
"); |
| 149 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'flex-start' value through CSS."); |
| 150 |
| 151 test(function() { |
| 152 checkValues(placeContentEnd, "placeContent", "place-content", "", "end end")
; |
| 153 checkPlaceContentValues(placeContentEnd, "", "end", "end"); |
| 154 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'end' value through CSS."); |
| 155 |
| 156 test(function() { |
| 157 checkValues(placeContentSpaceBetween, "placeContent", "place-content", "", "
space-between space-between"); |
| 158 checkPlaceContentValues(placeContentSpaceBetween, "", "space-between", "spac
e-between"); |
| 159 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'space-between' value through CSS."); |
| 160 |
| 161 test(function() { |
| 162 checkValues(placeContentStretch, "placeContent", "place-content", "", "stret
ch stretch"); |
| 163 checkPlaceContentValues(placeContentStretch, "", "stretch", "stretch"); |
| 164 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'stretch' value through CSS."); |
| 165 |
| 166 test(function() { |
| 167 checkValues(placeContentStartEnd, "placeContent", "place-content", "", "star
t end"); |
| 168 checkPlaceContentValues(placeContentStartEnd, "", "start", "end"); |
| 169 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'start end' value through CSS."); |
| 170 |
| 171 test(function() { |
| 172 checkValues(placeContentStartSpaceEvenly, "placeContent", "place-content", "
", "start space-evenly"); |
| 173 checkPlaceContentValues(placeContentStartSpaceEvenly, "", "start", "space-ev
enly"); |
| 174 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'start space-evenly' value through CSS."); |
| 175 |
| 176 test(function() { |
| 177 checkValues(placeContentStartBaseline, "placeContent", "place-content", "",
"start baseline"); |
| 178 checkPlaceContentValues(placeContentStartBaseline, "", "start", "baseline"); |
| 179 }, "Test getting the Computed Value of place-content's longhand properties when
setting 'start baseline' value through CSS."); |
| 180 |
| 181 test(function() { |
| 182 checkValues(placeContentAuto, "placeContent", "place-content", "", "normal n
ormal"); |
| 183 checkPlaceContentValues(placeContentAuto, "", "normal", "normal"); |
| 184 }, "Test setting '' as incorrect value through CSS."); |
| 185 |
| 186 test(function() { |
| 187 checkValues(placeContentAuto, "placeContent", "place-content", "", "normal n
ormal"); |
| 188 checkPlaceContentValues(placeContentAuto, "", "normal", "normal"); |
| 189 }, "Test setting 'auto' as incorrect value through CSS."); |
| 190 |
| 191 test(function() { |
| 192 checkValues(placeContentNone, "placeContent", "place-content", "", "normal n
ormal"); |
| 193 checkPlaceContentValues(placeContentNone, "", "normal", "normal"); |
| 194 }, "Test setting 'none' as incorrect value through CSS."); |
| 195 |
| 196 test(function() { |
| 197 checkValues(placeContentSafe, "placeContent", "place-content", "", "normal n
ormal"); |
| 198 checkPlaceContentValues(placeContentSafe, "", "normal", "normal"); |
| 199 }, "Test setting 'safe' as incorrect value through CSS."); |
| 200 |
| 201 test(function() { |
| 202 checkValues(placeContentStartSafe, "placeContent", "place-content", "", "nor
mal normal"); |
| 203 checkPlaceContentValues(placeContentStartSafe, "", "normal", "normal"); |
| 204 }, "Test setting 'start safe' as incorrect value through CSS."); |
| 205 |
| 206 test(function() { |
| 207 checkValues(placeContentStartSafe, "placeContent", "place-content", "", "nor
mal normal"); |
| 208 checkPlaceContentValues(placeContentStartSafe, "", "normal", "normal"); |
| 209 }, "Test setting 'baseline safe' as incorrect value through CSS."); |
| 210 |
| 211 test(function() { |
| 212 checkValues(placeContentStartEndLeft, "placeContent", "place-content", "", "
normal normal"); |
| 213 checkPlaceContentValues(placeContentStartEndLeft, "", "normal", "normal"); |
| 214 }, "Test setting 'start end left' as incorrect value through CSS."); |
| 215 |
| 216 test(function() { |
| 217 checkPlaceContentValuesJS("center", "center", "center"); |
| 218 checkPlaceContentValuesJS("center start", "center", "start"); |
| 219 checkPlaceContentValuesJS("space-between end", "space-between", "end"); |
| 220 checkPlaceContentValuesJS("normal end", "normal", "end"); |
| 221 }, "Test setting values through JS."); |
| 222 |
| 223 test(function() { |
| 224 checkPlaceContentValuesBadJS("center safe", "normal", "normal"); |
| 225 checkPlaceContentValuesBadJS("center space-between center", "normal", "norma
l"); |
| 226 checkPlaceContentValuesBadJS("asrt", "normal", "normal"); |
| 227 checkPlaceContentValuesBadJS("auto", "normal", "normal"); |
| 228 checkPlaceContentValuesBadJS("10px", "normal", "normal"); |
| 229 checkPlaceContentValuesBadJS("stretch safe", "normal", "normal"); |
| 230 checkPlaceContentValuesBadJS("space-between start end", "normal", "normal"); |
| 231 checkPlaceContentValuesBadJS("", "normal", "normal"); |
| 232 }, "Test setting incorrect values through JS."); |
| 233 |
| 234 test(function() { |
| 235 checkPlaceContentInitialValue(); |
| 236 }, "Test the 'initial' value of the place-content shorthand and its longhand pro
perties' Computed value"); |
| 237 |
| 238 test(function() { |
| 239 checkPlaceContentInheritValue(); |
| 240 }, "Test the 'inherit' value of the place-content shorthand and its longhand pro
perties' Computed value"); |
| 241 |
| 242 |
| 243 </script> |
| 244 </body> |
| 245 </html> |
| OLD | NEW |