OLD | NEW |
1 <html> | 1 <html> |
2 <head> | 2 <head> |
3 <script src="../../http/tests/inspector/inspector-test.js"></script> | 3 <script src="../../http/tests/inspector/inspector-test.js"></script> |
4 <script src="../../http/tests/inspector/elements-test.js"></script> | 4 <script src="../../http/tests/inspector/elements-test.js"></script> |
5 <script src="edit-dom-test.js"></script> | 5 <script src="edit-dom-test.js"></script> |
6 <script> | 6 <script> |
7 | 7 |
8 function test() | 8 function test() |
9 { | 9 { |
10 // Save time on style updates. | 10 // Save time on style updates. |
11 WebInspector.inspectorView.showPanel("elements"); | 11 WebInspector.inspectorView.showPanel("elements"); |
12 WebInspector.StylesSidebarPane.prototype.update = function() {}; | 12 WebInspector.StylesSidebarPane.prototype.update = function() {}; |
13 WebInspector.MetricsSidebarPane.prototype.update = function() {}; | 13 WebInspector.MetricsSidebarPane.prototype.update = function() {}; |
14 | 14 |
15 InspectorTest.runTestSuite([ | 15 InspectorTest.runTestSuite([ |
16 function testSetUp(next) | 16 function testSetUp(next) |
17 { | 17 { |
18 InspectorTest.expandElementsTree(next); | 18 InspectorTest.expandElementsTree(next); |
19 }, | 19 }, |
20 | 20 |
21 function testRemove(next) | 21 function testRemove(next) |
22 { | 22 { |
23 InspectorTest.domActionTestForNodeId("testRemove", "node-to-remove",
testBody, next); | 23 InspectorTest.domActionTestForNodeId("testRemove", "node-to-remove",
testBody, next); |
24 | 24 |
25 function testBody(node, done) | 25 function testBody(node, done) |
26 { | 26 { |
27 var treeElement = WebInspector.panels.elements.treeOutline.findT
reeElement(node); | 27 var treeElement = InspectorTest.firstElementsTreeOutline().findT
reeElement(node); |
28 treeElement.remove(); | 28 treeElement.remove(); |
29 InspectorTest.runAfterPendingDispatches(done); | 29 InspectorTest.runAfterPendingDispatches(done); |
30 } | 30 } |
31 }, | 31 }, |
32 | 32 |
33 function testSetNodeName(next) | 33 function testSetNodeName(next) |
34 { | 34 { |
35 InspectorTest.domActionTestForNodeId("testSetNodeName", "node-to-set
-name", testBody, next); | 35 InspectorTest.domActionTestForNodeId("testSetNodeName", "node-to-set
-name", testBody, next); |
36 | 36 |
37 function testBody(node, done) | 37 function testBody(node, done) |
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
112 return; | 112 return; |
113 } | 113 } |
114 } | 114 } |
115 InspectorTest.addResult("Comment node not found"); | 115 InspectorTest.addResult("Comment node not found"); |
116 InspectorTest.completeTest(); | 116 InspectorTest.completeTest(); |
117 } | 117 } |
118 InspectorTest.domActionTest("testEditCommentAsHTML", commentNodeSele
ctionCallback, testBody, next); | 118 InspectorTest.domActionTest("testEditCommentAsHTML", commentNodeSele
ctionCallback, testBody, next); |
119 | 119 |
120 function testBody(node, done) | 120 function testBody(node, done) |
121 { | 121 { |
122 var treeElement = WebInspector.panels.elements.treeOutline.findT
reeElement(node); | 122 var treeElement = InspectorTest.firstElementsTreeOutline().findT
reeElement(node); |
123 treeElement._editAsHTML(); | 123 treeElement._editAsHTML(); |
124 InspectorTest.runAfterPendingDispatches(step2); | 124 InspectorTest.runAfterPendingDispatches(step2); |
125 | 125 |
126 function step2() | 126 function step2() |
127 { | 127 { |
128 InspectorTest.addResult(treeElement._editing.codeMirror.getV
alue()); | 128 InspectorTest.addResult(treeElement._editing.codeMirror.getV
alue()); |
129 treeElement._editing.codeMirror.setValue("<div foo=\"bar-com
ment\">Element</div>"); | 129 treeElement._editing.codeMirror.setValue("<div foo=\"bar-com
ment\">Element</div>"); |
130 var event = InspectorTest.createKeyEvent("Enter"); | 130 var event = InspectorTest.createKeyEvent("Enter"); |
131 event.isMetaOrCtrlForTest = true; | 131 event.isMetaOrCtrlForTest = true; |
132 treeElement._htmlEditElement.dispatchEvent(event); | 132 treeElement._htmlEditElement.dispatchEvent(event); |
133 InspectorTest.runAfterPendingDispatches(done); | 133 InspectorTest.runAfterPendingDispatches(done); |
134 } | 134 } |
135 } | 135 } |
136 }, | 136 }, |
137 | 137 |
138 function testEditAsHTML(next) | 138 function testEditAsHTML(next) |
139 { | 139 { |
140 InspectorTest.domActionTestForNodeId("testEditAsHTML", "node-to-edit
-as-html", testBody, next); | 140 InspectorTest.domActionTestForNodeId("testEditAsHTML", "node-to-edit
-as-html", testBody, next); |
141 | 141 |
142 function testBody(node, done) | 142 function testBody(node, done) |
143 { | 143 { |
144 var treeElement = WebInspector.panels.elements.treeOutline.findT
reeElement(node); | 144 var treeElement = InspectorTest.firstElementsTreeOutline().findT
reeElement(node); |
145 treeElement._editAsHTML(); | 145 treeElement._editAsHTML(); |
146 InspectorTest.runAfterPendingDispatches(step2); | 146 InspectorTest.runAfterPendingDispatches(step2); |
147 | 147 |
148 function step2() | 148 function step2() |
149 { | 149 { |
150 InspectorTest.addResult(treeElement._editing.codeMirror.getV
alue()); | 150 InspectorTest.addResult(treeElement._editing.codeMirror.getV
alue()); |
151 treeElement._editing.codeMirror.setValue("<span foo=\"bar\">
<span id=\"inner-span\">Span contents</span></span>"); | 151 treeElement._editing.codeMirror.setValue("<span foo=\"bar\">
<span id=\"inner-span\">Span contents</span></span>"); |
152 var event = InspectorTest.createKeyEvent("Enter"); | 152 var event = InspectorTest.createKeyEvent("Enter"); |
153 event.isMetaOrCtrlForTest = true; | 153 event.isMetaOrCtrlForTest = true; |
154 treeElement._htmlEditElement.dispatchEvent(event); | 154 treeElement._htmlEditElement.dispatchEvent(event); |
155 InspectorTest.runAfterPendingDispatches(InspectorTest.expand
ElementsTree.bind(InspectorTest, done)); | 155 InspectorTest.runAfterPendingDispatches(InspectorTest.expand
ElementsTree.bind(InspectorTest, done)); |
156 } | 156 } |
157 } | 157 } |
158 }, | 158 }, |
159 | 159 |
160 function testEditInvisibleCharsAsHTML(next) | 160 function testEditInvisibleCharsAsHTML(next) |
161 { | 161 { |
162 InspectorTest.domActionTestForNodeId("testEditInvisibleCharsAsHTML",
"node-with-invisible-chars", testBody, next); | 162 InspectorTest.domActionTestForNodeId("testEditInvisibleCharsAsHTML",
"node-with-invisible-chars", testBody, next); |
163 | 163 |
164 function testBody(node, done) | 164 function testBody(node, done) |
165 { | 165 { |
166 var treeElement = WebInspector.panels.elements.treeOutline.findT
reeElement(node); | 166 var treeElement = InspectorTest.firstElementsTreeOutline().findT
reeElement(node); |
167 treeElement._editAsHTML(); | 167 treeElement._editAsHTML(); |
168 InspectorTest.runAfterPendingDispatches(step2); | 168 InspectorTest.runAfterPendingDispatches(step2); |
169 | 169 |
170 function step2() | 170 function step2() |
171 { | 171 { |
172 var codeMirror = treeElement._editing.codeMirror; | 172 var codeMirror = treeElement._editing.codeMirror; |
173 InspectorTest.addResult(codeMirror.getValue()); | 173 InspectorTest.addResult(codeMirror.getValue()); |
174 codeMirror.setValue(codeMirror.getValue().replace(/&/g, '#')
); | 174 codeMirror.setValue(codeMirror.getValue().replace(/&/g, '#')
); |
175 var event = InspectorTest.createKeyEvent("Enter"); | 175 var event = InspectorTest.createKeyEvent("Enter"); |
176 event.isMetaOrCtrlForTest = true; | 176 event.isMetaOrCtrlForTest = true; |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 | 258 |
259 </script> | 259 </script> |
260 </div> | 260 </div> |
261 | 261 |
262 <div id="testEditCommentAsHTML"> | 262 <div id="testEditCommentAsHTML"> |
263 <!-- Comment --> | 263 <!-- Comment --> |
264 </div> | 264 </div> |
265 </div> | 265 </div> |
266 </body> | 266 </body> |
267 </html> | 267 </html> |
OLD | NEW |