Chromium Code Reviews| 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 if (window.testRunner) | |
| 43 window.testRunner.waitUntilDone(); | |
| 44 | |
| 45 function dispatchEvent(clientX, clientY, expectedElementID, expectedOffsetX, exp ectedOffsetY) { | |
| 46 var e = document.createEvent("MouseEvent"); | |
| 47 e.initMouseEvent("click", true, true, window, 1, 1, 1, clientX, clientY, fal se, false, false, false, 0, document); | |
| 48 e.expectedElementID = expectedElementID; | |
| 49 e.expectedOffsetX = expectedOffsetX; | |
| 50 e.expectedOffsetY = expectedOffsetY; | |
| 51 var target = document.elementFromPoint(e.clientX, e.clientY); | |
| 52 target.dispatchEvent(e); | |
| 53 } | |
| 54 | |
| 55 onclick = function(event) { | |
| 56 if (!event.expectedElementID) | |
| 57 return; | |
| 58 shouldBe("event.target.id", "event.expectedElementID"); | |
| 59 shouldBe("event.offsetX", "event.expectedOffsetX"); | |
| 60 shouldBe("event.offsetY", "event.expectedOffsetY"); | |
| 61 } | |
| 62 | |
| 63 onload = function() { | |
| 64 dispatchEvent(380, 500, 'in-column1', 79, 29); | |
| 65 dispatchEvent(480, 400, 'in-column2', 63, 29); | |
| 66 dispatchEvent(632, 321, 'in-column3', 99, 0); | |
| 67 | |
| 68 if (window.testRunner) | |
| 69 window.testRunner.notifyDone(); | |
|
Julien - ping for review
2015/03/26 15:38:57
You don't need the waitUntilDone / notifyDone call
mstensho (USE GERRIT)
2015/03/26 16:33:44
Done.
| |
| 70 } | |
| 71 </script> | |
| OLD | NEW |