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