[Web Animations] Implement CSS Animations and CSS Transitions as Web Animations
[WebKit-https.git] / LayoutTests / css3 / flexbox / new-alignment-values-invalid-if-grid-not-enabled.html
1 <!DOCTYPE html>
2 <script src="../../resources/testharness.js"></script>
3 <script src="../../resources/testharnessreport.js"></script>
4 <script src="../resources/alignment-parsing-utils-th.js"></script>
5 <html>
6  <body>
7      <p>Test to verify that the new alignment values are parsed as invalid if Grid Layout is disabled and in any case they do not cause a crash because assertions in flexbox layout code.</p>
8      <div id="log"></div>
9
10      <div id="flexContainer" style="display: flex">
11          <div id="flexItem"></div>
12      </div>
13 <script>
14
15 var container = document.getElementById("flexContainer");
16 var item = document.getElementById("flexItem");
17
18 function checkAlignSelfValue(value, computedValue, gridEnabled)
19 {
20     item.style.webkitAlignSelf = value;
21     if (gridEnabled)
22         checkValues(item, "alignSelf", "align-self", value, computedValue);
23     else
24         checkValues(item, "alignSelf", "align-self", "flex-start", "flex-start");
25 }
26
27 function checkAlignItemsValue(value, computedValue, gridEnabled)
28 {
29     container.style.webkitAlignItems = value;
30     if (gridEnabled) {
31         checkValues(container, "alignItems", "align-items", value, computedValue);
32         checkValues(item, "alignSelf", "align-self", "auto", "auto");
33     } else {
34         checkValues(container, "alignItems", "align-items", "flex-end", "flex-end");
35         checkValues(item, "alignSelf", "align-self", "auto", "auto");
36     }
37 }
38
39 function checkSelfAlignmentValues(gridEnabled)
40 {
41     if (window.internals)
42         internals.settings.setCSSGridLayoutEnabled(gridEnabled)
43
44     item.style.webkitAlignSelf = "flex-start";
45
46     checkAlignSelfValue("unsafe start", "unsafe start", gridEnabled)
47     checkAlignSelfValue("start", "start", gridEnabled)
48     checkAlignSelfValue("end", "end", gridEnabled)
49     checkAlignSelfValue("safe flex-start", "safe flex-start", gridEnabled)
50     checkAlignSelfValue("self-start", "self-start", gridEnabled)
51     checkAlignSelfValue("self-end", "self-end", gridEnabled)
52 }
53
54 function checkDefaultAlignmentValues(gridEnabled)
55 {
56     if (window.internals)
57         internals.settings.setCSSGridLayoutEnabled(gridEnabled)
58
59     container.style.webkitAlignItems = "flex-end";
60     item.style.webkitAlignSelf = "auto";
61
62     checkAlignItemsValue("unsafe start", "unsafe start", gridEnabled)
63     checkAlignItemsValue("start", "start", gridEnabled)
64     checkAlignItemsValue("end", "end", gridEnabled)
65     checkAlignItemsValue("safe flex-start", "safe flex-start", gridEnabled)
66     checkAlignItemsValue("self-start", "self-start", gridEnabled)
67     checkAlignItemsValue("self-end", "self-end", gridEnabled)
68 }
69
70 test(function() {
71     checkSelfAlignmentValues(false);
72 }, "New Self-Alignment values should be invalid when grid layout is DISABLED.");
73
74 test(function() {
75     checkDefaultAlignmentValues(false);
76 }, "New Default-Alignment values should be invalid when grid layout is DISABLED.");
77
78 test(function() {
79     checkSelfAlignmentValues(true);
80 }, "Even when grid layout is ENABLED, new Self-Alignment values should not violate assertions in FlexibleBox layout logic..");
81
82 test(function() {
83     checkDefaultAlignmentValues(true);
84 }, "Even when grid layout is ENABLED, new Default-Alignment values should not violate assertions in FlexibleBox layout logic..");
85
86 </script>
87
88 </body>
89 </html>