Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / third_party / WebKit / LayoutTests / inspector / elements / edit / undo-dom-edits.html
blobae7e74e81eb143b505c85f3d86b08a0f6e7e3f72
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>
7 function test()
9 var testSuite = [];
11 function testSetUp(next)
13 InspectorTest.addResult("Setting up");
14 InspectorTest.expandElementsTree(callback);
16 function callback()
18 InspectorTest.expandElementsTree(next);
21 testSuite.push(testSetUp);
24 function testRemove(callback)
26 var node = InspectorTest.expandedNodeWithId("node-to-remove");
27 node.removeNode(callback);
29 testSuite.push(InspectorTest.generateUndoTest(testRemove));
32 function testSetNodeName(callback)
34 var node = InspectorTest.expandedNodeWithId("node-to-set-name");
35 node.setNodeName("span", callback);
37 testSuite.push(InspectorTest.generateUndoTest(testSetNodeName));
40 function testSetNodeValue(callback)
42 var node = InspectorTest.expandedNodeWithId("node-to-set-value");
43 node.firstChild.setNodeValue("New Text", callback);
45 testSuite.push(InspectorTest.generateUndoTest(testSetNodeValue));
47 function testEditAsHTML(callback)
49 var node = InspectorTest.expandedNodeWithId("node-to-edit-as-html");
50 node.setOuterHTML("<div id=\"node-to-edit-as-html\"><div id=\"span2\">Text2</div></div><span>Second node</span>", callback);
52 testSuite.push(InspectorTest.generateUndoTest(testEditAsHTML));
54 InspectorTest.runTestSuite(testSuite);
57 </script>
58 </head>
60 <body onload="runTest()">
61 <p>
62 Tests that DOM modifications done in the Elements panel are undoable.
63 </p>
65 <div style="display:none">
66 <div id="testRemove">
67 <div id="node-to-remove"></div>
68 </div>
70 <div id="testSetNodeName">
71 <div id="node-to-set-name"></div>
72 </div>
74 <div id="testSetNodeValue">
75 <div id="node-to-set-value">Text</div>
76 </div>
78 <div id="testEditAsHTML">
79 <div id="node-to-edit-as-html"><span id="span">Text</span></div>
80 </div>
81 </div>
83 </body>
84 </html>