OLD | NEW |
| (Empty) |
1 <!doctype html> | |
2 <html> | |
3 <head> | |
4 <script src="../../../resources/js-test.js"></script> | |
5 <script src="../resources/helper.js"></script> | |
6 <style> | |
7 body { font-family: monospace; } | |
8 #region, #region2 { width: 250px; height: 50px; } | |
9 .article { -webkit-flow-into: flow; } | |
10 .article2 { -webkit-flow-into: flow2; } | |
11 .region { -webkit-flow-from: flow; } | |
12 .region2 { -webkit-flow-from: flow2; } | |
13 .noRegion { -webkit-flow-from: none; } | |
14 </style> | |
15 </head> | |
16 <body> | |
17 <div id="console"></div> | |
18 <div id="article" class="article"></div> | |
19 <div id="region" class="region"></div> | |
20 <div id="region2"></div> | |
21 <script> | |
22 if (window.testRunner) | |
23 testRunner.dumpAsText(); | |
24 description("Test for 90759: [CSSRegions] Rename NamedFlow::getRegio
nsByContentNode to NamedFlow::getRegionsByContent"); | |
25 | |
26 var namedFlow = getFlowByName("flow"); | |
27 | |
28 // Getting the regions for a non existant node should return null. | |
29 var pElement; | |
30 var regionList = namedFlow.getRegionsByContent(pElement); | |
31 shouldBeNonNull("regionList"); | |
32 shouldBeZero("regionList.length"); | |
33 | |
34 // Getting the regions for an element that was not added to the dom
should return an empty list. | |
35 pElement = document.createElement("p"); | |
36 | |
37 var regionList2 = namedFlow.getRegionsByContent(pElement); | |
38 shouldBeNonNull("regionList2"); | |
39 shouldEvaluateTo("regionList2.length", 0); | |
40 shouldBeTrue("regionList != regionList2"); | |
41 | |
42 // Add the element to the dom but not in the flow. The region list s
hould be empty. | |
43 document.body.appendChild(pElement); | |
44 var regionList3 = namedFlow.getRegionsByContent(pElement); | |
45 shouldBeNonNull("regionList3"); | |
46 shouldEvaluateTo("regionList3.length", 0); | |
47 | |
48 // Add the same element to the flow. The region list should contain
one region. | |
49 document.body.removeChild(pElement); | |
50 document.getElementById("article").appendChild(pElement); | |
51 var regionList4 = namedFlow.getRegionsByContent(pElement); | |
52 shouldBeNonNull("regionList4"); | |
53 shouldEvaluateTo("regionList4.length", 1); | |
54 shouldBeEqualToString("regionList4.item(0).id", "region"); | |
55 | |
56 // Remove the region node and get the region list. The list should b
e empty. | |
57 document.getElementById("region").className = "noRegion"; | |
58 var regionList5 = namedFlow.getRegionsByContent(pElement); | |
59 shouldBeNonNull("regionList5"); | |
60 shouldEvaluateTo("regionList5.length", 0); | |
61 | |
62 // Bring back the region and get the region list. The list should ha
ve one element. | |
63 document.getElementById("region").className = "region"; | |
64 var regionList6 = namedFlow.getRegionsByContent(pElement); | |
65 shouldBeNonNull("regionList6"); | |
66 shouldEvaluateTo("regionList6.length", 1); | |
67 shouldBeEqualToString("regionList6.item(0).id", "region"); | |
68 | |
69 // Remove the named flow, the region list should be empty. | |
70 document.getElementById("article").className = ""; | |
71 var regionList7 = namedFlow.getRegionsByContent(pElement); | |
72 shouldBeNonNull("regionList7"); | |
73 shouldEvaluateTo("regionList7.length", 0); | |
74 | |
75 // Move the article to another named flow, the region list should be
empty. | |
76 document.getElementById("article").className = "article2"; | |
77 var namedFlow2 = getFlowByName("flow2"); | |
78 var regionList8 = namedFlow2.getRegionsByContent(pElement); | |
79 shouldBeNonNull("regionList8"); | |
80 shouldEvaluateTo("regionList8.length", 0); | |
81 | |
82 // Add a region to the second named flow, the region list should con
tain one element | |
83 // since the p element is a child of article that is collected by fl
ow2. | |
84 document.getElementById("region2").className = "region2"; | |
85 var regionList9 = namedFlow2.getRegionsByContent(pElement); | |
86 shouldBeNonNull("regionList9"); | |
87 shouldEvaluateTo("regionList9.length", 1); | |
88 </script> | |
89 </body> | |
90 </html> | |
91 | |
OLD | NEW |