test_bug1287321.html 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1287321
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 1287321</title>
  9. <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  11. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  12. <script type="application/javascript">
  13. /** Test for Bug 1287321 **/
  14. function test() {
  15. var r = document.getElementById("range");
  16. var rect = r.getBoundingClientRect();
  17. var y = parseInt((rect.height / 2));
  18. var movement = parseInt(rect.width / 10);
  19. var x = movement;
  20. synthesizeMouse(r, x, y, { type: "mousedown" });
  21. x += movement;
  22. var eventCount = 0;
  23. r.oninput = function() {
  24. ++eventCount;
  25. }
  26. synthesizeMouse(r, x, y, { type: "mousemove" });
  27. is(eventCount, 1, "Got the expected input event");
  28. x += movement;
  29. synthesizeMouse(r, x, y, { type: "mousemove" });
  30. is(eventCount, 2, "Got the expected input event");
  31. synthesizeMouse(r, x, y, { type: "mousemove" });
  32. is(eventCount, 2, "Got the expected input event");
  33. x += movement;
  34. synthesizeMouse(r, x, y, { type: "mousemove" });
  35. is(eventCount, 3, "Got the expected input event");
  36. synthesizeMouse(r, x, y, { type: "mouseup" });
  37. is(eventCount, 3, "Got the expected input event");
  38. SimpleTest.finish();
  39. }
  40. SimpleTest.waitForExplicitFinish();
  41. SimpleTest.waitForFocus(test);
  42. </script>
  43. </head>
  44. <body>
  45. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1287321">Mozilla Bug 1287321</a>
  46. <input type="range" id="range">
  47. </body>
  48. </html>