test_bug1285128.html 1.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. <!DOCTYPE HTML>
  2. <html>
  3. <!--
  4. https://bugzilla.mozilla.org/show_bug.cgi?id=1285128
  5. -->
  6. <head>
  7. <meta charset="utf-8">
  8. <title>Test for Bug 1285128</title>
  9. <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
  10. <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
  11. <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
  12. </head>
  13. <body>
  14. <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1285128">Mozilla Bug 1285128</a>
  15. <p id="display"></p>
  16. <div id="target0" style="width: 50px; height: 50px; background: green"></div>
  17. <div id="target1" style="width: 50px; height: 50px; background: red"></div>
  18. <script type="text/javascript">
  19. /** Test for Bug 1285128 **/
  20. SimpleTest.waitForExplicitFinish();
  21. function runTests() {
  22. let target0 = window.document.getElementById("target0");
  23. let pointerEventsList = ["pointerover", "pointerenter", "pointerdown",
  24. "pointerup", "pointerleave", "pointerout"];
  25. let receivedPointerEvents = false;
  26. pointerEventsList.forEach((elem, index, arr) => {
  27. target0.addEventListener(elem, (event) => {
  28. ok(false, "receiving event " + event.type);
  29. receivedPointerEvents = true;
  30. }, false);
  31. });
  32. target1.addEventListener("mouseup", () => {
  33. ok(!receivedPointerEvents, "synthesized mousemove should not trigger any pointer events");
  34. SimpleTest.finish();
  35. });
  36. synthesizeMouseAtCenter(target0, { type: "mousemove",
  37. inputSource: SpecialPowers.Ci.nsIDOMMouseEvent.MOZ_SOURCE_MOUSE,
  38. isWidgetEventSynthesized: true });
  39. synthesizeMouseAtCenter(target1, { type: "mousedown" });
  40. synthesizeMouseAtCenter(target1, { type: "mouseup" });
  41. }
  42. SpecialPowers.pushPrefEnv({"set": [["dom.w3c_pointer_events.enabled", true]]}, runTests);
  43. </script>
  44. </body>
  45. </html>