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