| 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 src="edit-dom-test.js"></script> |
| 6 <script> |
| 7 |
| 8 function test() |
| 9 { |
| 10 // Save time on style updates. |
| 11 WebInspector.StylesSidebarPane.prototype.update = function() {}; |
| 12 WebInspector.MetricsSidebarPane.prototype.update = function() {}; |
| 13 |
| 14 InspectorTest.runTestSuite([ |
| 15 function testSetUp(next) |
| 16 { |
| 17 InspectorTest.expandElementsTree(next); |
| 18 }, |
| 19 |
| 20 function testEditInvisibleCharsAsHTML(next) |
| 21 { |
| 22 InspectorTest.domActionTestForNodeId("testEditInvisibleCharsAsHTML",
"node-with-invisible-chars", testBody, next); |
| 23 |
| 24 function testBody(node, done) |
| 25 { |
| 26 var treeOutline = InspectorTest.firstElementsTreeOutline(); |
| 27 var treeElement = treeOutline.findTreeElement(node); |
| 28 treeOutline.toggleEditAsHTML(node); |
| 29 InspectorTest.runAfterPendingDispatches(step2); |
| 30 |
| 31 function step2() |
| 32 { |
| 33 var codeMirror = treeElement._editing.codeMirror; |
| 34 InspectorTest.addResult(codeMirror.getValue()); |
| 35 codeMirror.setValue(codeMirror.getValue().replace(/&/g, '#')
); |
| 36 var event = InspectorTest.createKeyEvent("Enter"); |
| 37 event.isMetaOrCtrlForTest = true; |
| 38 treeElement._htmlEditElement.dispatchEvent(event); |
| 39 InspectorTest.runAfterPendingDispatches(InspectorTest.expand
ElementsTree.bind(InspectorTest, done)); |
| 40 } |
| 41 } |
| 42 }, |
| 43 |
| 44 function testEditScript(next) |
| 45 { |
| 46 InspectorTest.domActionTestForNodeId("testEditScript", "node-to-edit
-script", testBody, next); |
| 47 |
| 48 function testBody(node, done) |
| 49 { |
| 50 InspectorTest.editNodePartAndRun(node, "webkit-html-text-node",
"var i = 0;\n var j = 0;\n", done); |
| 51 } |
| 52 }, |
| 53 |
| 54 function testEditSVGAttribute(next) |
| 55 { |
| 56 InspectorTest.domActionTestForNodeId("testEditSVG", "node-to-edit-sv
g-attribute", testBody, next); |
| 57 |
| 58 function testBody(node, done) |
| 59 { |
| 60 var treeOutline = InspectorTest.firstElementsTreeOutline(); |
| 61 var treeElement = treeOutline.findTreeElement(node); |
| 62 treeOutline.toggleEditAsHTML(node); |
| 63 InspectorTest.runAfterPendingDispatches(step2); |
| 64 |
| 65 function step2() |
| 66 { |
| 67 var value = treeElement._editing.codeMirror.getValue(); |
| 68 InspectorTest.addResult(value); |
| 69 treeElement._editing.codeMirror.setValue(value.replace("100"
, "110")); |
| 70 var event = InspectorTest.createKeyEvent("Enter"); |
| 71 event.isMetaOrCtrlForTest = true; |
| 72 treeElement._htmlEditElement.dispatchEvent(event); |
| 73 InspectorTest.runAfterPendingDispatches(InspectorTest.expand
ElementsTree.bind(InspectorTest, done)); |
| 74 } |
| 75 } |
| 76 } |
| 77 ]); |
| 78 } |
| 79 |
| 80 </script> |
| 81 </head> |
| 82 |
| 83 <body onload="runTest()"> |
| 84 <p> |
| 85 Tests that user can mutate DOM by means of elements panel. |
| 86 </p> |
| 87 |
| 88 <div> |
| 89 <div id="testEditInvisibleCharsAsHTML"> |
| 90 <div id="node-with-invisible-chars">A B C D E&zwnj
;F‍G‏H‎I</div> |
| 91 </div> |
| 92 |
| 93 <div id="testEditScript"> |
| 94 <script id="node-to-edit-script"> |
| 95 |
| 96 var i = 0; |
| 97 var j = 5; |
| 98 for (; i < j; ++i) { |
| 99 // Do nothing. |
| 100 } |
| 101 |
| 102 </script> |
| 103 </div> |
| 104 |
| 105 <div id="testEditSVG"> |
| 106 <svg id="node-to-edit-svg-attribute" xmlns:xlink="test" width="100"> |
| 107 </svg> |
| 108 </div> |
| 109 </div> |
| 110 </body> |
| 111 </html> |
| OLD | NEW |