OLD | NEW |
(Empty) | |
| 1 <!DOCTYPE html> |
| 2 <style> |
| 3 body { |
| 4 margin: 0; |
| 5 } |
| 6 |
| 7 #columns { |
| 8 position: absolute; |
| 9 width: 332px; |
| 10 height: 200px; |
| 11 top: 320px; |
| 12 left: 300px; |
| 13 border: 1px solid black; |
| 14 -webkit-column-count: 3; |
| 15 -webkit-column-gap: 16px; |
| 16 column-fill: auto; |
| 17 line-height: 50px; |
| 18 } |
| 19 </style> |
| 20 |
| 21 <div id="columns"> |
| 22 <br> |
| 23 <br> |
| 24 <div> |
| 25 <br> |
| 26 <div id="in-column1">first</div> |
| 27 </div> |
| 28 <br> |
| 29 <div> |
| 30 <div id="in-column2">second</div> |
| 31 <br> |
| 32 <br> |
| 33 <div id="in-column3">third</div> |
| 34 <br> |
| 35 </div> |
| 36 </div> |
| 37 |
| 38 <script src="../../resources/js-test.js"></script> |
| 39 <script> |
| 40 description("Dispatch mouse click events in each column and check the result."); |
| 41 |
| 42 function dispatchEvent(clientX, clientY, expectedElementID, expectedOffsetX, exp
ectedOffsetY) { |
| 43 var e = document.createEvent("MouseEvent"); |
| 44 e.initMouseEvent("click", true, true, window, 1, 1, 1, clientX, clientY, fal
se, false, false, false, 0, document); |
| 45 e.expectedElementID = expectedElementID; |
| 46 e.expectedOffsetX = expectedOffsetX; |
| 47 e.expectedOffsetY = expectedOffsetY; |
| 48 var target = document.elementFromPoint(e.clientX, e.clientY); |
| 49 target.dispatchEvent(e); |
| 50 } |
| 51 |
| 52 onclick = function(event) { |
| 53 if (!event.expectedElementID) |
| 54 return; |
| 55 shouldBe("event.target.id", "event.expectedElementID"); |
| 56 shouldBe("event.offsetX", "event.expectedOffsetX"); |
| 57 shouldBe("event.offsetY", "event.expectedOffsetY"); |
| 58 } |
| 59 |
| 60 onload = function() { |
| 61 dispatchEvent(380, 500, 'in-column1', 79, 29); |
| 62 dispatchEvent(480, 400, 'in-column2', 63, 29); |
| 63 dispatchEvent(632, 321, 'in-column3', 99, 0); |
| 64 } |
| 65 </script> |
OLD | NEW |