| Index: third_party/WebKit/LayoutTests/inspector/elements/edit/edit-dom-actions-3.html
|
| diff --git a/third_party/WebKit/LayoutTests/inspector/elements/edit/edit-dom-actions-3.html b/third_party/WebKit/LayoutTests/inspector/elements/edit/edit-dom-actions-3.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..4882b4ef0b0a0424ad18f44b90be23e46cdb8b75
|
| --- /dev/null
|
| +++ b/third_party/WebKit/LayoutTests/inspector/elements/edit/edit-dom-actions-3.html
|
| @@ -0,0 +1,99 @@
|
| +<html>
|
| +<head>
|
| +<script src="../../../http/tests/inspector/inspector-test.js"></script>
|
| +<script src="../../../http/tests/inspector/elements-test.js"></script>
|
| +<script src="edit-dom-test.js"></script>
|
| +<script>
|
| +
|
| +function test()
|
| +{
|
| + // Save time on style updates.
|
| + WebInspector.StylesSidebarPane.prototype.update = function() {};
|
| + WebInspector.MetricsSidebarPane.prototype.update = function() {};
|
| +
|
| + InspectorTest.runTestSuite([
|
| + function testSetUp(next)
|
| + {
|
| + InspectorTest.expandElementsTree(next);
|
| + },
|
| +
|
| + function testEditCommentAsHTML(next)
|
| + {
|
| + function commentNodeSelectionCallback(testNode, callback)
|
| + {
|
| + var childNodes = testNode.children();
|
| + for (var i = 0; i < childNodes.length; ++i) {
|
| + if (childNodes[i].nodeType() === 8) {
|
| + WebInspector.Revealer.reveal(childNodes[i]);
|
| + callback(childNodes[i]);
|
| + return;
|
| + }
|
| + }
|
| + InspectorTest.addResult("Comment node not found");
|
| + InspectorTest.completeTest();
|
| + }
|
| + InspectorTest.domActionTest("testEditCommentAsHTML", commentNodeSelectionCallback, testBody, next);
|
| +
|
| + function testBody(node, done)
|
| + {
|
| + var treeOutline = InspectorTest.firstElementsTreeOutline();
|
| + var treeElement = treeOutline.findTreeElement(node);
|
| + treeOutline.toggleEditAsHTML(node);
|
| + InspectorTest.runAfterPendingDispatches(step2);
|
| +
|
| + function step2()
|
| + {
|
| + InspectorTest.addResult(treeElement._editing.codeMirror.getValue());
|
| + treeElement._editing.codeMirror.setValue("<div foo=\"bar-comment\">Element</div>");
|
| + var event = InspectorTest.createKeyEvent("Enter");
|
| + event.isMetaOrCtrlForTest = true;
|
| + treeElement._htmlEditElement.dispatchEvent(event);
|
| + InspectorTest.runAfterPendingDispatches(done);
|
| + }
|
| + }
|
| + },
|
| +
|
| + function testEditAsHTML(next)
|
| + {
|
| + InspectorTest.domActionTestForNodeId("testEditAsHTML", "node-to-edit-as-html", testBody, next);
|
| +
|
| + function testBody(node, done)
|
| + {
|
| + var treeOutline = InspectorTest.firstElementsTreeOutline();
|
| + var treeElement = treeOutline.findTreeElement(node);
|
| + treeOutline.toggleEditAsHTML(node);
|
| + InspectorTest.runAfterPendingDispatches(step2);
|
| +
|
| + function step2()
|
| + {
|
| + InspectorTest.addResult(treeElement._editing.codeMirror.getValue());
|
| + treeElement._editing.codeMirror.setValue("<span foo=\"bar\"><span id=\"inner-span\">Span contents</span></span>");
|
| + var event = InspectorTest.createKeyEvent("Enter");
|
| + event.isMetaOrCtrlForTest = true;
|
| + treeElement._htmlEditElement.dispatchEvent(event);
|
| + InspectorTest.runAfterPendingDispatches(InspectorTest.expandElementsTree.bind(InspectorTest, done));
|
| + }
|
| + }
|
| + },
|
| + ]);
|
| +}
|
| +
|
| +</script>
|
| +</head>
|
| +
|
| +<body onload="runTest()">
|
| +<p>
|
| +Tests that user can mutate DOM by means of elements panel.
|
| +</p>
|
| +
|
| +<div>
|
| + <div id="testEditCommentAsHTML">
|
| + <!-- Comment -->
|
| + </div>
|
| +
|
| + <div id="testEditAsHTML">
|
| + <div id="node-to-edit-as-html"><span id="span">Text</span></div>
|
| + </div>
|
| +</div>
|
| +</body>
|
| +</html>
|
|
|