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>
10 // Save time on style updates.
11 WebInspector.StylesSidebarPane.prototype.update = function() {};
12 WebInspector.MetricsSidebarPane.prototype.update = function() {};
14 InspectorTest.runTestSuite([
15 function testSetUp(next)
17 InspectorTest.expandElementsTree(next);
20 function testSetAuthorShadowDOMElementAttribute(next)
22 InspectorTest.domActionTestForNodeId("testSetAuthorShadowDOMElementAttribute", "shadow-node-to-set-attribute", testBody, next);
24 function testBody(node, done)
26 InspectorTest.editNodePartAndRun(node, "webkit-html-attribute", "bar=\"edited attribute\"", done, true);
30 function testEditShadowDOMAsHTML(next)
32 InspectorTest.domActionTestForNodeId("testEditAuthorShadowDOMAsHTML", "authorShadowDOMElement", testBody, next);
34 function testBody(node, done)
36 var treeElement = InspectorTest.firstElementsTreeOutline().findTreeElement(node);
37 treeElement._editAsHTML();
38 InspectorTest.runAfterPendingDispatches(step2);
42 InspectorTest.addResult(treeElement._editing.codeMirror.getValue());
43 treeElement._editing.codeMirror.setValue("<span foo=\"shadow-span\"><span id=\"inner-shadow-span\">Shadow span contents</span></span>");
44 var event = InspectorTest.createKeyEvent("Enter");
45 event.isMetaOrCtrlForTest = true;
46 treeElement._htmlEditElement.dispatchEvent(event);
47 InspectorTest.runAfterPendingDispatches(InspectorTest.expandElementsTree.bind(InspectorTest, done));
58 <body onload="runTest()">
60 Tests that user can mutate author shadow DOM by means of elements panel.
64 <div id="testEditAuthorShadowDOMAsHTML"></div>
66 <div id="testSetAuthorShadowDOMElementAttribute"></div>
69 function createRootWithContents(id, html)
71 var container = document.getElementById(id);
72 var root = container.createShadowRoot();
73 root.innerHTML = html;
76 createRootWithContents("testEditAuthorShadowDOMAsHTML", "<div id='authorShadowDOMElement'></div>");
77 createRootWithContents("testSetAuthorShadowDOMElementAttribute", "<div foo='attribute value' id='shadow-node-to-set-attribute'></div>");