| OLD | NEW |
| (Empty) |
| 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 removeTextNode(id) | |
| 14 { | |
| 15 document.getElementById(id).textContent = ""; | |
| 16 } | |
| 17 | |
| 18 function test() | |
| 19 { | |
| 20 var containerNode; | |
| 21 | |
| 22 InspectorTest.runTestSuite([ | |
| 23 function testDumpInitial(next) | |
| 24 { | |
| 25 function callback(node) | |
| 26 { | |
| 27 containerNode = InspectorTest.expandedNodeWithId("container"); | |
| 28 | |
| 29 InspectorTest.addResult("========= Original ========"); | |
| 30 InspectorTest.dumpElementsTree(containerNode); | |
| 31 next(); | |
| 32 } | |
| 33 InspectorTest.expandElementsTree(callback); | |
| 34 }, | |
| 35 | |
| 36 function testRemoveTextNode(next) | |
| 37 { | |
| 38 function callback() | |
| 39 { | |
| 40 InspectorTest.addResult("===== Removed Text node ====="); | |
| 41 InspectorTest.dumpElementsTree(containerNode); | |
| 42 next(); | |
| 43 } | |
| 44 InspectorTest.evaluateInPage("removeTextNode('child1')", callback); | |
| 45 }, | |
| 46 | |
| 47 function testRemoveFirst(next) | |
| 48 { | |
| 49 function callback() | |
| 50 { | |
| 51 InspectorTest.addResult("===== Removed first ====="); | |
| 52 InspectorTest.dumpElementsTree(containerNode); | |
| 53 next(); | |
| 54 } | |
| 55 InspectorTest.evaluateInPage("removeNode('child1')", callback); | |
| 56 }, | |
| 57 | |
| 58 function testRemoveMiddle(next) | |
| 59 { | |
| 60 function callback() | |
| 61 { | |
| 62 InspectorTest.addResult("===== Removed middle ====="); | |
| 63 InspectorTest.dumpElementsTree(containerNode); | |
| 64 next(); | |
| 65 } | |
| 66 InspectorTest.evaluateInPage("removeNode('child3')", callback); | |
| 67 }, | |
| 68 | |
| 69 function testRemoveLast(next) | |
| 70 { | |
| 71 function callback() | |
| 72 { | |
| 73 InspectorTest.addResult("===== Removed last ====="); | |
| 74 InspectorTest.dumpElementsTree(containerNode); | |
| 75 next(); | |
| 76 } | |
| 77 InspectorTest.evaluateInPage("removeNode('child4')", callback); | |
| 78 }, | |
| 79 | |
| 80 function testRemoveTheOnly(next) | |
| 81 { | |
| 82 function callback() | |
| 83 { | |
| 84 InspectorTest.addResult("===== Removed the only ====="); | |
| 85 InspectorTest.dumpElementsTree(containerNode); | |
| 86 next(); | |
| 87 } | |
| 88 InspectorTest.evaluateInPage("removeNode('child2')", callback); | |
| 89 } | |
| 90 ]); | |
| 91 } | |
| 92 | |
| 93 </script> | |
| 94 </head> | |
| 95 | |
| 96 <body onload="runTest()"> | |
| 97 <p> | |
| 98 Tests that elements panel updates dom tree structure upon node removal. | |
| 99 </p> | |
| 100 | |
| 101 <div id="container"><div id="child1">Text</div><div id="child2"></div><div id="c
hild3"></div><div id="child4"></div></div> | |
| 102 | |
| 103 </body> | |
| 104 </html> | |
| OLD | NEW |