Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / fast / regions / cssom / webkit-named-flow-collection.html
1 <!doctype html>
2 <html>
3 <body>
4 <script src="../../../resources/js-test.js"></script>
5 <script>
6     description("Tests WebKitNamedFlowCollection interface")
7     if (window.testRunner)
8         testRunner.dumpAsText();
9
10     var region1 = document.createElement("div");
11     var region2 = document.createElement("div");
12
13     debug("Test WebKitNamedFlowCollection length property");
14
15     shouldBe("document.webkitGetNamedFlows().length", "0");
16
17     document.body.appendChild(region1);
18     shouldBe("region1.style.webkitFlowFrom = 'flow1'; document.webkitGetNamedFlows().length", "1");
19
20     document.body.appendChild(region2);
21     shouldBe("region2.style.webkitFlowFrom = 'flow2'; document.webkitGetNamedFlows().length", "2");
22
23     document.body.removeChild(region1);
24     shouldBe("region1.style.webkitFlowFrom = ''; document.webkitGetNamedFlows().length", "1");
25
26     document.body.removeChild(region2);
27     shouldBe("region2.style.webkitFlowFrom = ''; document.webkitGetNamedFlows().length", "0");
28
29     document.body.appendChild(region1);
30     document.body.appendChild(region2);
31     region1.style.webkitFlowFrom = 'flow1';
32     region2.style.webkitFlowFrom = 'flow2';
33
34     debug("Test WebKitNamedFlowCollection index getter");
35     shouldBeTrue("(document.webkitGetNamedFlows()[0].name == 'flow1' && document.webkitGetNamedFlows()[1].name == 'flow2') \
36         || (document.webkitGetNamedFlows()[0].name == 'flow2' && document.webkitGetNamedFlows()[1].name == 'flow1')");
37
38     debug("Test WebKitNamedFlowCollection name getter");
39     shouldBeEqualToString("document.webkitGetNamedFlows().flow1.name", "flow1");
40     shouldBeEqualToString("document.webkitGetNamedFlows().flow2.name", "flow2");
41     shouldBeUndefined("document.webkitGetNamedFlows().undefinedNamedProperty");
42
43     document.body.removeChild(region1);
44     document.body.removeChild(region2);
45 </script>
46 </body>
47 </html>