test_bug1285128.html (1924B)
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 src="/tests/SimpleTest/SimpleTest.js"></script> 10 <script 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 20 /** Test for Bug 1285128 */ 21 SimpleTest.waitForExplicitFinish(); 22 23 function runTests() { 24 let target0 = window.document.getElementById("target0"); 25 let pointerEventsList = ["pointerover", "pointerenter", "pointerdown", 26 "pointerup", "pointerleave", "pointerout"]; 27 const pointerEvents = []; 28 pointerEventsList.forEach((elem, index, arr) => { 29 target0.addEventListener(elem, event => pointerEvents.push(event.type)); 30 }); 31 32 target1.addEventListener("mouseup", () => { 33 is( 34 pointerEvents.join(", "), 35 [ 36 "pointerover", // Should be caused by the synthesized mousemove 37 "pointerenter", 38 "pointerout", // Should be caused by clicking target1 39 "pointerleave", 40 ].join(", "), 41 "Synthesizing mousemove should cause only pointer boundary events" 42 ); 43 SimpleTest.finish(); 44 }); 45 46 synthesizeMouseAtCenter(target0, { type: "mousemove", 47 inputSource: MouseEvent.MOZ_SOURCE_MOUSE, 48 isWidgetEventSynthesized: true }); 49 synthesizeMouseAtCenter(target1, { type: "mousedown" }); 50 synthesizeMouseAtCenter(target1, { type: "mouseup" }); 51 } 52 53 SimpleTest.waitForFocus(runTests); 54 55 </script> 56 </body> 57 </html>