helper_bug1299195.html (1843B)
1 <!DOCTYPE HTML> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <meta name="viewport" content="width=device-width; initial-scale=1.0; user-scalable=no"> 6 <title>Test pointer events are dispatched once for touch tap</title> 7 <script src="/tests/SimpleTest/paint_listener.js"></script> 8 <script type="application/javascript" src="apz_test_utils.js"></script> 9 <script type="application/javascript" src="apz_test_native_event_utils.js"></script> 10 <script type="application/javascript"> 11 /** Test for Bug 1299195 */ 12 async function runTests() { 13 let target0 = document.getElementById("target0"); 14 let mouseup_count = 0; 15 let mousedown_count = 0; 16 let pointerup_count = 0; 17 let pointerdown_count = 0; 18 19 target0.addEventListener("mouseup", () => { 20 ++mouseup_count; 21 if (mouseup_count == 2) { 22 is(mousedown_count, 2, "Double tap with touch should fire 2 mousedown events"); 23 is(mouseup_count, 2, "Double tap with touch should fire 2 mouseup events"); 24 is(pointerdown_count, 2, "Double tap with touch should fire 2 pointerdown events"); 25 is(pointerup_count, 2, "Double tap with touch should fire 2 pointerup events"); 26 subtestDone(); 27 } 28 }); 29 target0.addEventListener("mousedown", () => { 30 ++mousedown_count; 31 }); 32 target0.addEventListener("pointerup", () => { 33 ++pointerup_count; 34 }); 35 target0.addEventListener("pointerdown", () => { 36 ++pointerdown_count; 37 }); 38 await synthesizeNativeTap(document.getElementById("target0"), 100, 100); 39 await synthesizeNativeTap(document.getElementById("target0"), 100, 100); 40 } 41 waitUntilApzStable().then(runTests); 42 </script> 43 </head> 44 <body> 45 <div id="target0" style="width: 200px; height: 200px; background: green"></div> 46 </body> 47 </html>