OLD | NEW |
(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.inspectorView.showPanel("elements"); |
| 12 WebInspector.StylesSidebarPane.prototype.update = function() {}; |
| 13 WebInspector.MetricsSidebarPane.prototype.update = function() {}; |
| 14 |
| 15 InspectorTest.runTestSuite([ |
| 16 function testSetUp(next) |
| 17 { |
| 18 InspectorTest.nodeWithId("authorShadowDOMElement"); |
| 19 InspectorTest.nodeWithId("testSetAuthorShadowDOMElementAttribute", c
heckTree); |
| 20 function checkTree() |
| 21 { |
| 22 InspectorTest.expandElementsTree(next); |
| 23 } |
| 24 }, |
| 25 |
| 26 function testSetAuthorShadowDOMElementAttribute(next) |
| 27 { |
| 28 InspectorTest.domActionTestForNodeId("testSetAuthorShadowDOMElementA
ttribute", "shadow-node-to-set-attribute", testBody, next); |
| 29 |
| 30 function testBody(node, done) |
| 31 { |
| 32 InspectorTest.editNodePartAndRun(node, "webkit-html-attribute",
"bar=\"edited attribute\"", done, true); |
| 33 } |
| 34 }, |
| 35 |
| 36 function testEditShadowDOMAsHTML(next) |
| 37 { |
| 38 InspectorTest.domActionTestForNodeId("testEditAuthorShadowDOMAsHTML"
, "authorShadowDOMElement", testBody, next); |
| 39 |
| 40 function testBody(node, done) |
| 41 { |
| 42 var treeElement = WebInspector.panels.elements.treeOutline.findT
reeElement(node); |
| 43 treeElement._editAsHTML(); |
| 44 InspectorTest.runAfterPendingDispatches(step2); |
| 45 |
| 46 function step2() |
| 47 { |
| 48 InspectorTest.addResult(treeElement._editing.codeMirror.getV
alue()); |
| 49 treeElement._editing.codeMirror.setValue("<span foo=\"shadow
-span\"><span id=\"inner-shadow-span\">Shadow span contents</span></span>"); |
| 50 var event = InspectorTest.createKeyEvent("Enter"); |
| 51 event.isMetaOrCtrlForTest = true; |
| 52 treeElement._htmlEditElement.dispatchEvent(event); |
| 53 InspectorTest.runAfterPendingDispatches(InspectorTest.expand
ElementsTree.bind(InspectorTest, done)); |
| 54 } |
| 55 } |
| 56 } |
| 57 |
| 58 ]); |
| 59 } |
| 60 |
| 61 </script> |
| 62 </head> |
| 63 |
| 64 <body onload="runTest()"> |
| 65 <p> |
| 66 Tests that user can mutate author shadow DOM by means of elements panel. |
| 67 </p> |
| 68 |
| 69 <div> |
| 70 <div id="testEditAuthorShadowDOMAsHTML"></div> |
| 71 |
| 72 <div id="testSetAuthorShadowDOMElementAttribute"></div> |
| 73 </div> |
| 74 <script> |
| 75 function createRootWithContents(id, html) |
| 76 { |
| 77 var container = document.getElementById(id); |
| 78 var root = container.createShadowRoot(); |
| 79 root.innerHTML = html; |
| 80 } |
| 81 |
| 82 createRootWithContents("testEditAuthorShadowDOMAsHTML", "<div id='authorShadowDO
MElement'></div>"); |
| 83 createRootWithContents("testSetAuthorShadowDOMElementAttribute", "<div foo='attr
ibute value' id='shadow-node-to-set-attribute'></div>"); |
| 84 </script> |
| 85 </body> |
| 86 </html> |
OLD | NEW |