| 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> | 5 <script> |
| 6 | 6 |
| 7 function test() | 7 function test() |
| 8 { | 8 { |
| 9 InspectorTest.firstElementsTreeOutline().addEventListener(WebInspector.Eleme
ntsTreeOutline.Events.SelectedNodeChanged, selectedNodeChanged); | 9 InspectorTest.firstElementsTreeOutline().addEventListener(Elements.ElementsT
reeOutline.Events.SelectedNodeChanged, selectedNodeChanged); |
| 10 | 10 |
| 11 var nodeChangesRemaining = 2; | 11 var nodeChangesRemaining = 2; |
| 12 function selectedNodeChanged(event) | 12 function selectedNodeChanged(event) |
| 13 { | 13 { |
| 14 var node = event.data.node; | 14 var node = event.data.node; |
| 15 if (node.nodeName() === "BODY") | 15 if (node.nodeName() === "BODY") |
| 16 return; | 16 return; |
| 17 InspectorTest.addResult("SelectedNodeChanged: " + node.localName() + " "
+ shadowDOMPart(node)); | 17 InspectorTest.addResult("SelectedNodeChanged: " + node.localName() + " "
+ shadowDOMPart(node)); |
| 18 if (!--nodeChangesRemaining) | 18 if (!--nodeChangesRemaining) |
| 19 InspectorTest.completeTest(); | 19 InspectorTest.completeTest(); |
| 20 } | 20 } |
| 21 | 21 |
| 22 function shadowDOMPart(node) | 22 function shadowDOMPart(node) |
| 23 { | 23 { |
| 24 if (!node.isInShadowTree()) | 24 if (!node.isInShadowTree()) |
| 25 return "(not in shadow tree)"; | 25 return "(not in shadow tree)"; |
| 26 return "(in " + (node.ancestorUserAgentShadowRoot() ? "user-agent" : "au
thor") + " shadow DOM)"; | 26 return "(in " + (node.ancestorUserAgentShadowRoot() ? "user-agent" : "au
thor") + " shadow DOM)"; |
| 27 } | 27 } |
| 28 | 28 |
| 29 InspectorTest.nodeWithId("nested-input", function(node) { | 29 InspectorTest.nodeWithId("nested-input", function(node) { |
| 30 node.shadowRoots()[0].getChildNodes(childrenCallback); | 30 node.shadowRoots()[0].getChildNodes(childrenCallback); |
| 31 | 31 |
| 32 function childrenCallback(children) | 32 function childrenCallback(children) |
| 33 { | 33 { |
| 34 var shadowDiv = children[0]; | 34 var shadowDiv = children[0]; |
| 35 InspectorTest.addResult("User-agent shadow DOM hidden:"); | 35 InspectorTest.addResult("User-agent shadow DOM hidden:"); |
| 36 WebInspector.panels.elements.revealAndSelectNode(shadowDiv).then(()
=> { | 36 UI.panels.elements.revealAndSelectNode(shadowDiv).then(() => { |
| 37 WebInspector.settingForTest("showUAShadowDOM").set(true); | 37 Common.settingForTest("showUAShadowDOM").set(true); |
| 38 InspectorTest.addResult("User-agent shadow DOM shown:"); | 38 InspectorTest.addResult("User-agent shadow DOM shown:"); |
| 39 WebInspector.panels.elements.revealAndSelectNode(shadowDiv); | 39 UI.panels.elements.revealAndSelectNode(shadowDiv); |
| 40 }); | 40 }); |
| 41 } | 41 } |
| 42 }); | 42 }); |
| 43 } | 43 } |
| 44 </script> | 44 </script> |
| 45 </head> | 45 </head> |
| 46 | 46 |
| 47 <body onload="runTest()"> | 47 <body onload="runTest()"> |
| 48 | 48 |
| 49 <p id="description">This test verifies that the correct node is revealed in the
DOM tree when asked to reveal a user-agent shadow DOM node.</p> | 49 <p id="description">This test verifies that the correct node is revealed in the
DOM tree when asked to reveal a user-agent shadow DOM node.</p> |
| 50 | 50 |
| 51 <p id="test1"></p> | 51 <p id="test1"></p> |
| 52 | 52 |
| 53 <script> | 53 <script> |
| 54 var input = document.createElement("input"); | 54 var input = document.createElement("input"); |
| 55 input.id = "nested-input"; | 55 input.id = "nested-input"; |
| 56 input.value = "test"; | 56 input.value = "test"; |
| 57 test1.createShadowRoot().appendChild(input); | 57 test1.createShadowRoot().appendChild(input); |
| 58 </script> | 58 </script> |
| 59 | 59 |
| 60 </body> | 60 </body> |
| 61 </html> | 61 </html> |
| OLD | NEW |