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

Side by Side Diff: third_party/WebKit/LayoutTests/external/csswg-test/css-align-3/resources/alignment-parsing-utils.js

Issue 2762043004: [css-align] Import the CSS Box Alignment tests from the CSSWG Test Suite (Closed)
Patch Set: Upload suggested changes. Created 3 years, 9 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 var selfPositionValues = [ "start", "end", "self-start", "self-end", "left", "ri ght", "center", "flex-start", "flex-end"];
2 var contentPositionValues = [ "start", "end", "left", "right", "center", "flex-s tart", "flex-end"];
3 var distributionValues = [ "stretch", "space-around", "space-between", "space-ev enly"];
4 var baselineValues = [ "baseline", "first baseline", "last baseline"];
5
6 function checkPlaceShorhand(shorthand, alignValue, justifyValue)
7 {
8 var div = document.createElement("div");
9 var specifiedValue = (alignValue + " " + justifyValue).trim();
10 div.style[shorthand] = specifiedValue;
11 document.body.appendChild(div);
12
13 if (alignValue === justifyValue)
14 specifiedValue = alignValue;
15
16 var resolvedValue = getComputedStyle(div).getPropertyValue(shorthand);
17 if (alignValue === "first baseline")
18 alignValue = "baseline";
19 if (justifyValue === "first baseline")
20 justifyValue = "baseline";
21 if (justifyValue === "")
22 justifyValue = alignValue;
23 var expectedResolvedValue = (alignValue + " " + justifyValue).trim()
24
25 assert_equals(div.style[shorthand], specifiedValue, shorthand + " specified value");
26 // FIXME: We need https://github.com/w3c/csswg-drafts/issues/1041 to clarify which
27 // value is expected for the shorthand's 'resolved value".
28 assert_in_array(resolvedValue, ["", expectedResolvedValue], shorthand + " re solved value");
29 }
30
31 function checkPlaceShorhandLonghands(shorthand, alignLonghand, justifyLonghand, alignValue, justifyValue = "")
32 {
33 var div = document.createElement("div");
34 div.setAttribute("style", shorthand + ": " + alignValue + " " + justifyValue );
35 document.body.appendChild(div);
36 if (justifyValue === "")
37 justifyValue = alignValue;
38 assert_equals(div.style[alignLonghand],
39 alignValue, alignLonghand + " expanded value");
40 assert_equals(div.style[justifyLonghand],
41 justifyValue, justifyLonghand + " expanded value");
42 }
43
44 function checkPlaceShorthandInvalidValues(shorthand, alignLonghand, justifyLongh and, value)
45 {
46 var div = document.createElement("div");
47 var css = alignLonghand + ": start; " + justifyLonghand + ": end;" + shortha nd + ": " + value;
48 div.setAttribute("style", css);
49 document.body.appendChild(div);
50 assert_equals(div.style[alignLonghand],
51 "start", alignLonghand + " expanded value");
52 assert_equals(div.style[justifyLonghand],
53 "end", justifyLonghand + " expanded value");
54 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698