| Index: LayoutTests/inspector/elements/edit-dom-actions-shadow.html
|
| diff --git a/LayoutTests/inspector/elements/edit-dom-actions-shadow.html b/LayoutTests/inspector/elements/edit-dom-actions-shadow.html
|
| new file mode 100644
|
| index 0000000000000000000000000000000000000000..08789ce692471512ebed8e6193e5d2cc8286a77d
|
| --- /dev/null
|
| +++ b/LayoutTests/inspector/elements/edit-dom-actions-shadow.html
|
| @@ -0,0 +1,86 @@
|
| +<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.inspectorView.showPanel("elements");
|
| + WebInspector.StylesSidebarPane.prototype.update = function() {};
|
| + WebInspector.MetricsSidebarPane.prototype.update = function() {};
|
| +
|
| + InspectorTest.runTestSuite([
|
| + function testSetUp(next)
|
| + {
|
| + InspectorTest.nodeWithId("authorShadowDOMElement");
|
| + InspectorTest.nodeWithId("testSetAuthorShadowDOMElementAttribute", checkTree);
|
| + function checkTree()
|
| + {
|
| + InspectorTest.expandElementsTree(next);
|
| + }
|
| + },
|
| +
|
| + function testSetAuthorShadowDOMElementAttribute(next)
|
| + {
|
| + InspectorTest.domActionTestForNodeId("testSetAuthorShadowDOMElementAttribute", "shadow-node-to-set-attribute", testBody, next);
|
| +
|
| + function testBody(node, done)
|
| + {
|
| + InspectorTest.editNodePartAndRun(node, "webkit-html-attribute", "bar=\"edited attribute\"", done, true);
|
| + }
|
| + },
|
| +
|
| + function testEditShadowDOMAsHTML(next)
|
| + {
|
| + InspectorTest.domActionTestForNodeId("testEditAuthorShadowDOMAsHTML", "authorShadowDOMElement", testBody, next);
|
| +
|
| + function testBody(node, done)
|
| + {
|
| + var treeElement = WebInspector.panels.elements.treeOutline.findTreeElement(node);
|
| + treeElement._editAsHTML();
|
| + InspectorTest.runAfterPendingDispatches(step2);
|
| +
|
| + function step2()
|
| + {
|
| + InspectorTest.addResult(treeElement._editing.codeMirror.getValue());
|
| + treeElement._editing.codeMirror.setValue("<span foo=\"shadow-span\"><span id=\"inner-shadow-span\">Shadow 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 author shadow DOM by means of elements panel.
|
| +</p>
|
| +
|
| +<div>
|
| + <div id="testEditAuthorShadowDOMAsHTML"></div>
|
| +
|
| + <div id="testSetAuthorShadowDOMElementAttribute"></div>
|
| +</div>
|
| +<script>
|
| +function createRootWithContents(id, html)
|
| +{
|
| + var container = document.getElementById(id);
|
| + var root = container.createShadowRoot();
|
| + root.innerHTML = html;
|
| +}
|
| +
|
| +createRootWithContents("testEditAuthorShadowDOMAsHTML", "<div id='authorShadowDOMElement'></div>");
|
| +createRootWithContents("testSetAuthorShadowDOMElementAttribute", "<div foo='attribute value' id='shadow-node-to-set-attribute'></div>");
|
| +</script>
|
| +</body>
|
| +</html>
|
|
|