| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../http/tests/inspector/elements-test.js"></script> |
| <script> |
| |
| function removeNode(id) |
| { |
| var child = document.getElementById(id); |
| child.parentNode.removeChild(child); |
| } |
| |
| function test() |
| { |
| var containerNode; |
| |
| InspectorTest.runTestSuite([ |
| function testDumpInitial(next) |
| { |
| function callback(node) |
| { |
| containerNode = InspectorTest.expandedNodeWithId("container"); |
| |
| InspectorTest.addResult("========= Original ========"); |
| InspectorTest.dumpElementsTree(containerNode); |
| next(); |
| } |
| InspectorTest.expandElementsTree(callback); |
| }, |
| |
| function testRemoveFirst(next) |
| { |
| function callback() |
| { |
| InspectorTest.addResult("===== Removed first ====="); |
| InspectorTest.dumpElementsTree(containerNode); |
| next(); |
| } |
| InspectorTest.evaluateInPage("removeNode('child1')", callback); |
| }, |
| |
| function testRemoveMiddle(next) |
| { |
| function callback() |
| { |
| InspectorTest.addResult("===== Removed middle ====="); |
| InspectorTest.dumpElementsTree(containerNode); |
| next(); |
| } |
| InspectorTest.evaluateInPage("removeNode('child3')", callback); |
| }, |
| |
| function testRemoveLast(next) |
| { |
| function callback() |
| { |
| InspectorTest.addResult("===== Removed last ====="); |
| InspectorTest.dumpElementsTree(containerNode); |
| next(); |
| } |
| InspectorTest.evaluateInPage("removeNode('child4')", callback); |
| }, |
| |
| function testRemoveTheOnly(next) |
| { |
| function callback() |
| { |
| InspectorTest.addResult("===== Removed the only ====="); |
| InspectorTest.dumpElementsTree(containerNode); |
| next(); |
| } |
| InspectorTest.evaluateInPage("removeNode('child2')", callback); |
| } |
| ]); |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p> |
| Tests that elements panel updates dom tree structure upon node removal. |
| </p> |
| |
| <div id="container"><div id="child1"></div><div id="child2"></div><div id="child3"></div><div id="child4"></div></div> |
| |
| </body> |
| </html> |