| <html> |
| <head> |
| <script src="../../http/tests/inspector/inspector-test.js"></script> |
| <script src="../../http/tests/inspector/elements-test.js"></script> |
| <style> |
| div { |
| margin: 0; |
| padding: 0; |
| border: none; |
| } |
| #outer { |
| position: absolute; |
| top: 0; |
| left: 0; |
| bottom: 0; |
| right: 0; |
| } |
| #inner { |
| pointer-events: none; |
| position: absolute; |
| top: 10px; |
| left: 10px; |
| bottom: 10px; |
| right: 10px; |
| } |
| </style> |
| <script> |
| |
| function clickInner(withShift) |
| { |
| var target = document.getElementById("inner"); |
| var rect = target.getBoundingClientRect(); |
| // Simulate the mouse click over the target to trigger an event dispatch. |
| if (window.eventSender) { |
| window.eventSender.mouseMoveTo(rect.left + rect.width / 2, rect.top + rect.height / 2, withShift ? "shiftKey" : ""); |
| window.eventSender.mouseDown(); |
| window.eventSender.mouseUp(); |
| } |
| } |
| |
| function test() |
| { |
| function selectedNodeId() |
| { |
| var selectedElement = InspectorTest.firstElementsTreeOutline().selectedTreeElement; |
| if (!selectedElement) |
| return "<no selected node>"; |
| return selectedElement.node().getAttribute("id"); |
| } |
| |
| function expectSelectedNode(expectedId) |
| { |
| var id = selectedNodeId(); |
| if (id === expectedId) |
| InspectorTest.addResult("PASS: selected node with id '" + id + "'"); |
| else |
| InspectorTest.addResult("FAIL: unexpected selection " + id); |
| } |
| |
| function step1() |
| { |
| InspectorTest.overlayModel.setInspectMode(Protocol.Overlay.InspectMode.SearchForNode).then(step2); |
| } |
| |
| function step2() |
| { |
| InspectorTest.firstElementsTreeOutline().addEventListener(Elements.ElementsTreeOutline.Events.SelectedNodeChanged, step3); |
| InspectorTest.evaluateInPage("clickInner(true)"); |
| } |
| |
| function step3() |
| { |
| InspectorTest.firstElementsTreeOutline().removeEventListener(Elements.ElementsTreeOutline.Events.SelectedNodeChanged, step3); |
| expectSelectedNode("inner"); |
| InspectorTest.overlayModel.setInspectMode(Protocol.Overlay.InspectMode.SearchForNode).then(step4); |
| } |
| |
| function step4() |
| { |
| InspectorTest.firstElementsTreeOutline().addEventListener(Elements.ElementsTreeOutline.Events.SelectedNodeChanged, step5); |
| InspectorTest.evaluateInPage("clickInner(false)"); |
| } |
| |
| function step5() |
| { |
| InspectorTest.firstElementsTreeOutline().removeEventListener(Elements.ElementsTreeOutline.Events.SelectedNodeChanged, step5); |
| expectSelectedNode("outer"); |
| InspectorTest.completeTest(); |
| } |
| |
| step1(); |
| } |
| |
| </script> |
| </head> |
| |
| <body onload="runTest()"> |
| <p>Test that Web Inspector can inspect element with <code>pointer-events:none</code>. |
| </p> |
| <div id="outer"><div id="inner"></div></div> |
| </body> |
| </html> |