Upstream version 5.34.98.0
[platform/framework/web/crosswalk.git] / src / third_party / WebKit / LayoutTests / inspector / elements / remove-node.html
1 <html>
2 <head>
3 <script src="../../http/tests/inspector/inspector-test.js"></script>
4 <script src="../../http/tests/inspector/elements-test.js"></script>
5 <script>
6
7 function removeNode(id)
8 {
9     var child = document.getElementById(id);
10     child.parentNode.removeChild(child);
11 }
12
13 function test()
14 {
15     var containerNode;
16
17     InspectorTest.runTestSuite([
18         function testDumpInitial(next)
19         {
20             function callback(node)
21             {
22                 containerNode = InspectorTest.expandedNodeWithId("container");
23
24                 InspectorTest.addResult("========= Original ========");
25                 InspectorTest.dumpElementsTree(containerNode);
26                 next();
27             }
28             InspectorTest.expandElementsTree(callback);
29         },
30
31         function testRemoveFirst(next)
32         {
33             function callback()
34             {
35                 InspectorTest.addResult("===== Removed first =====");
36                 InspectorTest.dumpElementsTree(containerNode);
37                 next();
38             }
39             InspectorTest.evaluateInPage("removeNode('child1')", callback);
40         },
41
42         function testRemoveMiddle(next)
43         {
44             function callback()
45             {
46                 InspectorTest.addResult("===== Removed middle =====");
47                 InspectorTest.dumpElementsTree(containerNode);
48                 next();
49             }
50             InspectorTest.evaluateInPage("removeNode('child3')", callback);
51         },
52
53         function testRemoveLast(next)
54         {
55             function callback()
56             {
57                 InspectorTest.addResult("===== Removed last =====");
58                 InspectorTest.dumpElementsTree(containerNode);
59                 next();
60             }
61             InspectorTest.evaluateInPage("removeNode('child4')", callback);
62         },
63
64         function testRemoveTheOnly(next)
65         {
66             function callback()
67             {
68                 InspectorTest.addResult("===== Removed the only =====");
69                 InspectorTest.dumpElementsTree(containerNode);
70                 next();
71             }
72             InspectorTest.evaluateInPage("removeNode('child2')", callback);
73         }
74     ]);
75 }
76
77 </script>
78 </head>
79
80 <body onload="runTest()">
81 <p>
82 Tests that elements panel updates dom tree structure upon node removal.
83 </p>
84
85 <div id="container"><div id="child1"></div><div id="child2"></div><div id="child3"></div><div id="child4"></div></div>
86
87 </body>
88 </html>