test_bug556493.html 2.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  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 type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  9. <script type="application/javascript" 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. </div>
  22. <pre id="test">
  23. <script type="application/javascript">
  24. /** Test for Bug 556493 **/
  25. SimpleTest.waitForExplicitFinish();
  26. var downCount = 0;
  27. var upCount = 0;
  28. var clickCount = 0;
  29. function runTest() {
  30. var d0 = document.getElementById("d0");
  31. var d1 = document.getElementById("d1");
  32. var d2 = document.getElementById("d2");
  33. d0.onmousedown = function(e) { ++downCount; };
  34. d0.onmouseup = function(e) { ++upCount; }
  35. d0.onclick = function(e) { ++clickCount; }
  36. synthesizeMouse(d1, 3, 3, { type: "mousedown"});
  37. synthesizeMouse(d1, 3, 3, { type: "mouseup"});
  38. is(downCount, 1, "Wrong mousedown event count!");
  39. is(upCount, 1, "Wrong mouseup event count!");
  40. is(clickCount, 1, "Wrong click event count!");
  41. synthesizeMouse(d1, 3, 3, { type: "mousedown"});
  42. synthesizeMouse(d1, 30, 3, { type: "mouseup"});
  43. is(downCount, 2, "Wrong mousedown event count!");
  44. is(upCount, 2, "Wrong mouseup event count!");
  45. is(clickCount, 2, "Wrong click event count!");
  46. synthesizeMouse(d1, 3, 3, { type: "mousedown"});
  47. synthesizeMouse(d2, 3, 3, { type: "mouseup"});
  48. is(downCount, 3, "Wrong mousedown event count!");
  49. is(upCount, 3, "Wrong mouseup event count!");
  50. is(clickCount, 2, "Wrong click event count!");
  51. SimpleTest.finish();
  52. }
  53. </script>
  54. </pre>
  55. <div id="d0">
  56. Test divs --
  57. <div id="d1">t</div><div id="d2">t</div>
  58. --
  59. </div>
  60. </body>
  61. </html>