| 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 | 5 |
| 6 <script> | 6 <script> |
| 7 | 7 |
| 8 function click() | 8 function click() |
| 9 { | 9 { |
| 10 var target = document.getElementById("host"); | 10 var target = document.getElementById("host"); |
| 11 var rect = target.getBoundingClientRect(); | 11 var rect = target.getBoundingClientRect(); |
| 12 // Simulate the mouse click over the target to trigger an event dispatch. | 12 // Simulate the mouse click over the target to trigger an event dispatch. |
| 13 if (window.eventSender) { | 13 if (window.eventSender) { |
| 14 window.eventSender.mouseMoveTo(rect.left + 10, rect.top + 10); | 14 window.eventSender.mouseMoveTo(rect.left + 10, rect.top + 10); |
| 15 window.eventSender.mouseDown(); | 15 window.eventSender.mouseDown(); |
| 16 window.eventSender.mouseUp(); | 16 window.eventSender.mouseUp(); |
| 17 } | 17 } |
| 18 } | 18 } |
| 19 | 19 |
| 20 function test() | 20 function test() |
| 21 { | 21 { |
| 22 InspectorTest.domModel.setInspectMode(Protocol.DOM.InspectMode.SearchForNode
, step2); | 22 InspectorTest.domModel.setInspectMode(Protocol.DOM.InspectMode.SearchForNode
, step2); |
| 23 | 23 |
| 24 function step2() | 24 function step2() |
| 25 { | 25 { |
| 26 InspectorTest.firstElementsTreeOutline().addEventListener(WebInspector.E
lementsTreeOutline.Events.SelectedNodeChanged, step3); | 26 InspectorTest.firstElementsTreeOutline().addEventListener(Elements.Eleme
ntsTreeOutline.Events.SelectedNodeChanged, step3); |
| 27 InspectorTest.evaluateInPage("click()"); | 27 InspectorTest.evaluateInPage("click()"); |
| 28 } | 28 } |
| 29 | 29 |
| 30 function step3() | 30 function step3() |
| 31 { | 31 { |
| 32 InspectorTest.firstElementsTreeOutline().removeEventListener(WebInspecto
r.ElementsTreeOutline.Events.SelectedNodeChanged, step3); | 32 InspectorTest.firstElementsTreeOutline().removeEventListener(Elements.El
ementsTreeOutline.Events.SelectedNodeChanged, step3); |
| 33 var selectedElement = InspectorTest.firstElementsTreeOutline().selectedT
reeElement; | 33 var selectedElement = InspectorTest.firstElementsTreeOutline().selectedT
reeElement; |
| 34 InspectorTest.addResult("Node selected: " + selectedElement.node().getAt
tribute("id")); | 34 InspectorTest.addResult("Node selected: " + selectedElement.node().getAt
tribute("id")); |
| 35 InspectorTest.completeTest(); | 35 InspectorTest.completeTest(); |
| 36 } | 36 } |
| 37 } | 37 } |
| 38 | 38 |
| 39 </script> | 39 </script> |
| 40 </head> | 40 </head> |
| 41 | 41 |
| 42 <body onload="runTest()"> | 42 <body onload="runTest()"> |
| 43 | 43 |
| 44 <p>Test that devtools can inspect text element under shadow root.</p> | 44 <p>Test that devtools can inspect text element under shadow root.</p> |
| 45 | 45 |
| 46 <div><div><div id="host"></div></div></div> | 46 <div><div><div id="host"></div></div></div> |
| 47 <script> | 47 <script> |
| 48 var host = document.querySelector('#host'); | 48 var host = document.querySelector('#host'); |
| 49 var sr = host.createShadowRoot(); | 49 var sr = host.createShadowRoot(); |
| 50 sr.innerHTML = "Text Text Text<br>Text Text Text"; | 50 sr.innerHTML = "Text Text Text<br>Text Text Text"; |
| 51 </script> | 51 </script> |
| 52 | 52 |
| 53 </body> | 53 </body> |
| 54 </html> | 54 </html> |
| OLD | NEW |