Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(198)

Side by Side Diff: third_party/WebKit/LayoutTests/inspector/elements/edit/edit-dom-actions-3.html

Issue 1875373002: DevTools: split edit-dom-actions.html into three tests (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: split into two tests Created 4 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 testEditCommentAsHTML(next)
21 {
22 function commentNodeSelectionCallback(testNode, callback)
23 {
24 var childNodes = testNode.children();
25 for (var i = 0; i < childNodes.length; ++i) {
26 if (childNodes[i].nodeType() === 8) {
27 WebInspector.Revealer.reveal(childNodes[i]);
28 callback(childNodes[i]);
29 return;
30 }
31 }
32 InspectorTest.addResult("Comment node not found");
33 InspectorTest.completeTest();
34 }
35 InspectorTest.domActionTest("testEditCommentAsHTML", commentNodeSele ctionCallback, testBody, next);
36
37 function testBody(node, done)
38 {
39 var treeOutline = InspectorTest.firstElementsTreeOutline();
40 var treeElement = treeOutline.findTreeElement(node);
41 treeOutline.toggleEditAsHTML(node);
42 InspectorTest.runAfterPendingDispatches(step2);
43
44 function step2()
45 {
46 InspectorTest.addResult(treeElement._editing.codeMirror.getV alue());
47 treeElement._editing.codeMirror.setValue("<div foo=\"bar-com ment\">Element</div>");
48 var event = InspectorTest.createKeyEvent("Enter");
49 event.isMetaOrCtrlForTest = true;
50 treeElement._htmlEditElement.dispatchEvent(event);
51 InspectorTest.runAfterPendingDispatches(done);
52 }
53 }
54 },
55
56 function testEditAsHTML(next)
57 {
58 InspectorTest.domActionTestForNodeId("testEditAsHTML", "node-to-edit -as-html", testBody, next);
59
60 function testBody(node, done)
61 {
62 var treeOutline = InspectorTest.firstElementsTreeOutline();
63 var treeElement = treeOutline.findTreeElement(node);
64 treeOutline.toggleEditAsHTML(node);
65 InspectorTest.runAfterPendingDispatches(step2);
66
67 function step2()
68 {
69 InspectorTest.addResult(treeElement._editing.codeMirror.getV alue());
70 treeElement._editing.codeMirror.setValue("<span foo=\"bar\"> <span id=\"inner-span\">Span contents</span></span>");
71 var event = InspectorTest.createKeyEvent("Enter");
72 event.isMetaOrCtrlForTest = true;
73 treeElement._htmlEditElement.dispatchEvent(event);
74 InspectorTest.runAfterPendingDispatches(InspectorTest.expand ElementsTree.bind(InspectorTest, done));
75 }
76 }
77 },
78 ]);
79 }
80
81 </script>
82 </head>
83
84 <body onload="runTest()">
85 <p>
86 Tests that user can mutate DOM by means of elements panel.
87 </p>
88
89 <div>
90 <div id="testEditCommentAsHTML">
91 <!-- Comment -->
92 </div>
93
94 <div id="testEditAsHTML">
95 <div id="node-to-edit-as-html"><span id="span">Text</span></div>
96 </div>
97 </div>
98 </body>
99 </html>
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698