OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <html> |
| 3 <head> |
| 4 <script src="../../../resources/testharness.js"></script> |
| 5 <script src="../../../resources/testharnessreport.js"></script> |
| 6 </head> |
| 7 <body onload="runTest()"> |
| 8 <p>Ensure that simulated click is still dispatched to an inert node. |
| 9 To test manually, click the CLICK ME label and verify it does change the val
ue of the checkbox.</p> |
| 10 <div inert id="container"> |
| 11 <div> |
| 12 </div> |
| 13 <input type="checkbox" id="target"> |
| 14 </div> |
| 15 <label for="target">CLICK ME</label> |
| 16 <script> |
| 17 function clickOn(element) |
| 18 { |
| 19 if (!window.eventSender) |
| 20 return; |
| 21 |
| 22 var absoluteTop = 0; |
| 23 var absoluteLeft = 0; |
| 24 for (var parentNode = element; parentNode; parentNode = parentNode.offsetPar
ent) { |
| 25 absoluteLeft += parentNode.offsetLeft; |
| 26 absoluteTop += parentNode.offsetTop; |
| 27 } |
| 28 |
| 29 var x = absoluteLeft + element.offsetWidth / 2; |
| 30 var y = absoluteTop + element.offsetHeight / 2; |
| 31 eventSender.mouseMoveTo(x, y); |
| 32 eventSender.mouseDown(); |
| 33 eventSender.mouseUp(); |
| 34 } |
| 35 |
| 36 test(function() { |
| 37 clickOn(document.querySelector('label')); |
| 38 assert_true(document.getElementById('target').checked); |
| 39 }, "Simulated click should still be dispatched to an inert node."); |
| 40 </script> |
| 41 </body> |
| 42 </html> |
OLD | NEW |