Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 <!DOCTYPE html> | |
| 2 <html> | |
| 3 <head> | |
|
svillar
2017/02/02 09:11:19
No need for <html> and <head> tags
jfernandez
2017/02/06 15:17:17
Done.
| |
| 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 #placeContentAuto { | |
| 38 place-content: auto; | |
| 39 } | |
| 40 #placeContentNone { | |
| 41 place-content: none; | |
| 42 } | |
| 43 #placeContentSafe { | |
| 44 place-content: safe; | |
| 45 } | |
| 46 #placeContentStartSafe { | |
| 47 place-content: start safe; | |
| 48 } | |
| 49 #placeContentStartEndLeft { | |
| 50 place-content: start end left; | |
| 51 } | |
| 52 </style> | |
| 53 <script src="../../resources/testharness.js"></script> | |
| 54 <script src="../../resources/testharnessreport.js"></script> | |
| 55 <script src="resources/alignment-parsing-utils-th.js"></script> | |
| 56 </head> | |
| 57 <body> | |
| 58 <p>Test to verify that the new alignment values are parsed as invalid if Gri d Layout is disabled and in any case they do not cause a crash because assertion s in flexbox layout code.</p> | |
| 59 <div id="log"></div> | |
| 60 | |
| 61 <div id="placeContentNormal"></div> | |
| 62 <div id="placeContentBaseline"></div> | |
| 63 <div id="placeContentStart"></div> | |
| 64 <div id="placeContentFlexStart"></div> | |
| 65 <div id="placeContentEnd"></div> | |
| 66 <div id="placeContentSpaceBetween"></div> | |
| 67 <div id="placeContentStretch"></div> | |
| 68 <div id="placeContentStartEnd"></div> | |
| 69 <div id="placeContentStartSpaceEvenly"></div> | |
| 70 <div id="placeContentStartBaseline"></div> | |
| 71 | |
| 72 <div id="placeContentAuto"></div> | |
| 73 <div id="placeContentNone"></div> | |
| 74 <div id="placeContentSafe"></div> | |
| 75 <div id="placeContentStartSafe"></div> | |
| 76 <div id="placeContentBaselineSafe"></div> | |
| 77 <div id="placeContentStartEndLeft"></div> | |
| 78 <script> | |
| 79 function checkPlaceContentValues(element, value, alignValue, justifyValue) | |
| 80 { | |
| 81 checkValues(element, "alignContent", "align-content", value, alignValue); | |
| 82 checkValues(element, "justifyContent", "justify-content", value, justifyVal ue); | |
| 83 } | |
| 84 | |
| 85 function checkPlaceContentValuesJS(value, alignValue, justifyValue) | |
| 86 { | |
| 87 element = document.createElement("div"); | |
| 88 document.body.appendChild(element); | |
| 89 element.style.placeContent = value; | |
| 90 checkPlaceContentValues(element, value, alignValue, justifyValue) | |
| 91 } | |
| 92 | |
| 93 function checkPlaceContentValuesBadJS(value) | |
| 94 { | |
| 95 element.style.placeContent = ""; | |
| 96 element.style.placeContent = value; | |
| 97 checkPlaceContentValues(element, "", "normal", "normal") | |
| 98 } | |
| 99 | |
| 100 function checkPlaceContentInitialValue() | |
| 101 { | |
| 102 element = document.createElement("div"); | |
| 103 document.body.appendChild(element); | |
| 104 checkValues(element, "placeContent", "place-content", "", "normal normal"); | |
| 105 element.style.placeContent = "center"; | |
| 106 checkPlaceContentValues(element, "center", "center", "center"); | |
| 107 element.style.placeContent = "initial"; | |
| 108 checkValues(element, "placeContent", "place-content", "initial", "normal norm al"); | |
| 109 checkPlaceContentValues(element, "initial", "normal", "normal"); | |
| 110 } | |
| 111 | |
| 112 function checkPlaceContentInheritValue() | |
| 113 { | |
| 114 document.body.style.placeContent = "start"; | |
| 115 var anotherElement = document.createElement("div"); | |
| 116 document.body.appendChild(anotherElement); | |
| 117 checkPlaceContentValues(anotherElement, "", "normal", "normal"); | |
| 118 anotherElement.style.placeContent = "inherit"; | |
| 119 checkPlaceContentValues(anotherElement, "inherit", "start", "start"); | |
| 120 } | |
| 121 | |
| 122 | |
| 123 test(function() { | |
| 124 checkValues(placeContentNormal, "placeContent", "place-content", "", "normal normal"); | |
| 125 checkPlaceContentValues(placeContentNormal, "", "normal", "normal"); | |
| 126 }, "Test getting the Computed Value of place-content's longhand properties when setting 'normal' value through CSS."); | |
| 127 | |
| 128 test(function() { | |
| 129 checkValues(placeContentBaseline, "placeContent", "place-content", "", "base line baseline"); | |
| 130 checkPlaceContentValues(placeContentBaseline, "", "baseline", "baseline"); | |
| 131 }, "Test getting the Computed Value of place-content's longhand properties when setting 'baseline' value through CSS."); | |
| 132 | |
| 133 test(function() { | |
| 134 checkValues(placeContentStart, "placeContent", "place-content", "", "start s tart"); | |
| 135 checkPlaceContentValues(placeContentStart, "", "start", "start"); | |
| 136 }, "Test getting the Computed Value of place-content's longhand properties when setting 'start' value through CSS."); | |
| 137 | |
| 138 test(function() { | |
| 139 checkValues(placeContentFlexStart, "placeContent", "place-content", "", "fle x-start flex-start"); | |
| 140 checkPlaceContentValues(placeContentFlexStart, "", "flex-start", "flex-start "); | |
| 141 }, "Test getting the Computed Value of place-content's longhand properties when setting 'flex-start' value through CSS."); | |
| 142 | |
| 143 test(function() { | |
| 144 checkValues(placeContentEnd, "placeContent", "place-content", "", "end end") ; | |
| 145 checkPlaceContentValues(placeContentEnd, "", "end", "end"); | |
| 146 }, "Test getting the Computed Value of place-content's longhand properties when setting 'end' value through CSS."); | |
| 147 | |
| 148 test(function() { | |
| 149 checkValues(placeContentSpaceBetween, "placeContent", "place-content", "", " space-between space-between"); | |
| 150 checkPlaceContentValues(placeContentSpaceBetween, "", "space-between", "spac e-between"); | |
| 151 }, "Test getting the Computed Value of place-content's longhand properties when setting 'space-between' value through CSS."); | |
| 152 | |
| 153 test(function() { | |
| 154 checkValues(placeContentStretch, "placeContent", "place-content", "", "stret ch stretch"); | |
| 155 checkPlaceContentValues(placeContentStretch, "", "stretch", "stretch"); | |
| 156 }, "Test getting the Computed Value of place-content's longhand properties when setting 'stretch' value through CSS."); | |
| 157 | |
| 158 test(function() { | |
| 159 checkValues(placeContentStartEnd, "placeContent", "place-content", "", "star t end"); | |
| 160 checkPlaceContentValues(placeContentStartEnd, "", "start", "end"); | |
| 161 }, "Test getting the Computed Value of place-content's longhand properties when setting 'start end' value through CSS."); | |
| 162 | |
| 163 test(function() { | |
| 164 checkValues(placeContentStartSpaceEvenly, "placeContent", "place-content", " ", "start space-evenly"); | |
| 165 checkPlaceContentValues(placeContentStartSpaceEvenly, "", "start", "space-ev enly"); | |
| 166 }, "Test getting the Computed Value of place-content's longhand properties when setting 'start space-evenly' value through CSS."); | |
| 167 | |
| 168 test(function() { | |
| 169 checkValues(placeContentStartBaseline, "placeContent", "place-content", "", "start baseline"); | |
| 170 checkPlaceContentValues(placeContentStartBaseline, "", "start", "baseline"); | |
| 171 }, "Test getting the Computed Value of place-content's longhand properties when setting 'start baseline' value through CSS."); | |
| 172 | |
| 173 test(function() { | |
| 174 checkValues(placeContentAuto, "placeContent", "place-content", "", "normal n ormal"); | |
| 175 checkPlaceContentValues(placeContentAuto, "", "normal", "normal"); | |
| 176 }, "Test setting 'auto' as incorrect value through CSS."); | |
| 177 | |
| 178 test(function() { | |
| 179 checkValues(placeContentNone, "placeContent", "place-content", "", "normal n ormal"); | |
| 180 checkPlaceContentValues(placeContentNone, "", "normal", "normal"); | |
| 181 }, "Test setting 'none' as incorrect value through CSS."); | |
| 182 | |
| 183 test(function() { | |
| 184 checkValues(placeContentSafe, "placeContent", "place-content", "", "normal n ormal"); | |
| 185 checkPlaceContentValues(placeContentSafe, "", "normal", "normal"); | |
| 186 }, "Test setting 'safe' as incorrect value through CSS."); | |
| 187 | |
| 188 test(function() { | |
| 189 checkValues(placeContentStartSafe, "placeContent", "place-content", "", "nor mal normal"); | |
| 190 checkPlaceContentValues(placeContentStartSafe, "", "normal", "normal"); | |
| 191 }, "Test setting 'start safe' as incorrect value through CSS."); | |
| 192 | |
| 193 test(function() { | |
| 194 checkValues(placeContentStartSafe, "placeContent", "place-content", "", "nor mal normal"); | |
| 195 checkPlaceContentValues(placeContentStartSafe, "", "normal", "normal"); | |
| 196 }, "Test setting 'baseline safe' as incorrect value through CSS."); | |
| 197 | |
| 198 test(function() { | |
| 199 checkValues(placeContentStartEndLeft, "placeContent", "place-content", "", " normal normal"); | |
| 200 checkPlaceContentValues(placeContentStartEndLeft, "", "normal", "normal"); | |
| 201 }, "Test setting 'start end left' as incorrect value through CSS."); | |
| 202 | |
| 203 test(function() { | |
| 204 checkPlaceContentValuesBadJS("center safe", "normal", "normal"); | |
| 205 checkPlaceContentValuesBadJS("center space-between center", "normal", "norma l"); | |
| 206 checkPlaceContentValuesBadJS("asrt", "normal", "normal"); | |
| 207 checkPlaceContentValuesBadJS("auto", "normal", "normal"); | |
| 208 checkPlaceContentValuesBadJS("10px", "normal", "normal"); | |
| 209 checkPlaceContentValuesBadJS("stretch safe", "normal", "normal"); | |
| 210 checkPlaceContentValuesBadJS("space-between start end", "normal", "normal"); | |
| 211 }, "Test setting incorrect values through JS."); | |
| 212 | |
| 213 test(function() { | |
| 214 checkPlaceContentInitialValue(); | |
| 215 }, "Test the 'initial' value of the place-content shorthand and its longhand pro perties' Computed value"); | |
| 216 | |
| 217 test(function() { | |
| 218 checkPlaceContentInheritValue(); | |
| 219 }, "Test the 'inherit' value of the place-content shorthand and its longhand pro perties' Computed value"); | |
| 220 | |
| 221 | |
| 222 </script> | |
| 223 </body> | |
| 224 </html> | |
| OLD | NEW |