test_bug1305458.html 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1305458
  5. -->
  6. <head>
  7. <title>Test for Bug 1305458</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. input[type=number] {
  13. -moz-appearance: textfield;
  14. }
  15. input[type=number]:focus,
  16. input[type=number]:hover {
  17. -moz-appearance: number-input;
  18. }
  19. </style>
  20. </head>
  21. <body onload="doTest()">
  22. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1305458">Mozilla Bug 1305458</a>
  23. <input id="test_input" type="number">
  24. <div id="test_div">bar</div>
  25. <script>
  26. SimpleTest.waitForExplicitFinish();
  27. var change_count = 0;
  28. function doTest() {
  29. let input = document.getElementById("test_input");
  30. let div = document.getElementById("test_div");
  31. input.addEventListener("change", () => {
  32. ++change_count;
  33. }, false);
  34. // mouse hover
  35. input.focus();
  36. synthesizeMouse(input, 1, 1, {type: "mousemove"});
  37. synthesizeKey("1", {});
  38. input.blur();
  39. is(change_count, 1, "input should fire change when blur");
  40. input.focus();
  41. synthesizeMouse(div, 1, 1, {type: "mousemove"});
  42. synthesizeKey("1", {});
  43. input.blur();
  44. is(change_count, 2, "input should fire change when blur");
  45. SimpleTest.finish();
  46. }
  47. </script>
  48. </body>
  49. </html>