test_bug556493.html (1958B)
1 <!DOCTYPE HTML> 2 <html> 3 <!-- 4 https://bugzilla.mozilla.org/show_bug.cgi?id=556493 5 --> 6 <head> 7 <title>Test for Bug 556493</title> 8 <script src="/tests/SimpleTest/SimpleTest.js"></script> 9 <script src="/tests/SimpleTest/EventUtils.js"></script> 10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 11 <style> 12 div { 13 border: 1px solid; 14 } 15 </style> 16 </head> 17 <body onload="setTimeout(runTest, 0)"> 18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=556493">Mozilla Bug 556493</a> 19 <p id="display"></p> 20 <div id="content" style="display: none"> 21 22 </div> 23 <pre id="test"> 24 <script type="application/javascript"> 25 26 /** Test for Bug 556493 */ 27 28 SimpleTest.waitForExplicitFinish(); 29 30 var downCount = 0; 31 var upCount = 0; 32 var clickCount = 0; 33 function runTest() { 34 var d0 = document.getElementById("d0"); 35 var d1 = document.getElementById("d1"); 36 var d2 = document.getElementById("d2"); 37 38 d0.onmousedown = function(e) { ++downCount; }; 39 d0.onmouseup = function(e) { ++upCount; } 40 d0.onclick = function(e) { ++clickCount; } 41 42 synthesizeMouse(d1, 3, 3, { type: "mousedown"}); 43 synthesizeMouse(d1, 3, 3, { type: "mouseup"}); 44 45 is(downCount, 1, "Wrong mousedown event count!"); 46 is(upCount, 1, "Wrong mouseup event count!"); 47 is(clickCount, 1, "Wrong click event count!"); 48 49 synthesizeMouse(d1, 3, 3, { type: "mousedown"}); 50 synthesizeMouse(d1, 30, 3, { type: "mouseup"}); 51 52 is(downCount, 2, "Wrong mousedown event count!"); 53 is(upCount, 2, "Wrong mouseup event count!"); 54 is(clickCount, 2, "Wrong click event count!"); 55 56 synthesizeMouse(d1, 3, 3, { type: "mousedown"}); 57 synthesizeMouse(d2, 3, 3, { type: "mouseup"}); 58 59 is(downCount, 3, "Wrong mousedown event count!"); 60 is(upCount, 3, "Wrong mouseup event count!"); 61 is(clickCount, 3, "Wrong click event count!"); 62 63 SimpleTest.finish(); 64 } 65 66 </script> 67 </pre> 68 <div id="d0"> 69 Test divs -- 70 <div id="d1">t</div><div id="d2">t</div> 71 -- 72 </div> 73 </body> 74 </html>