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