Chromium Code Reviews| 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 | |
| 6 <script> | |
| 7 | |
| 8 function click() | |
| 9 { | |
| 10 var target = document.getElementById("host"); | |
| 11 var rect = target.getBoundingClientRect(); | |
| 12 // Simulate the mouse click over the target to trigger an event dispatch. | |
| 13 if (window.eventSender) { | |
| 14 window.eventSender.mouseMoveTo(rect.left + 10, rect.top + 10); | |
| 15 window.eventSender.mouseDown(); | |
| 16 window.eventSender.mouseUp(); | |
| 17 } | |
| 18 } | |
| 19 | |
| 20 function test() | |
| 21 { | |
| 22 WebInspector.inspectorView.showPanel("elements"); | |
|
apavlov
2014/03/18 08:49:39
optional: I've seen fast/ tests using eventSender
apavlov
2014/03/18 08:49:39
Won't the Elements panel open automatically?
pfeldman
2014/03/18 09:15:46
Done.
pfeldman
2014/03/18 09:15:46
We will only reach the sender if harness is there
| |
| 23 step1(); | |
| 24 | |
| 25 function step1() | |
| 26 { | |
| 27 WebInspector.domAgent.setInspectModeEnabled(true, false, step2); | |
| 28 } | |
| 29 | |
| 30 function step2() | |
| 31 { | |
| 32 WebInspector.panels.elements.treeOutline.addEventListener(WebInspector.E lementsTreeOutline.Events.SelectedNodeChanged, step3); | |
| 33 InspectorTest.evaluateInPage("click()"); | |
| 34 } | |
| 35 | |
| 36 function step3() | |
| 37 { | |
| 38 WebInspector.panels.elements.treeOutline.removeEventListener(WebInspecto r.ElementsTreeOutline.Events.SelectedNodeChanged, step3); | |
| 39 var selectedElement = WebInspector.panels.elements.treeOutline.selectedT reeElement; | |
| 40 InspectorTest.addResult("Node selected: " + selectedElement.representedO bject.getAttribute("id")); | |
| 41 InspectorTest.completeTest(); | |
| 42 } | |
| 43 } | |
| 44 | |
| 45 </script> | |
| 46 </head> | |
| 47 | |
| 48 <body onload="runTest()"> | |
| 49 | |
| 50 <p>Test that devtools can inspect text element under shadow root.</p> | |
| 51 | |
| 52 <div><div><div id="host"></div></div></div> | |
| 53 <script> | |
| 54 var host = document.querySelector('#host'); | |
| 55 var sr = host.createShadowRoot(); | |
| 56 sr.innerHTML = "Text Text Text<br>Text Text Text"; | |
| 57 </script> | |
| 58 | |
| 59 </body> | |
| 60 </html> | |
| OLD | NEW |