dblclick_event_mouse.html (1579B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <meta charset="utf-8"> 5 <title>dblclick event for the mouse pointer type</title> 6 <link rel="author" title="Google" href="http://www.google.com/" /> 7 <script src="/resources/testharness.js"></script> 8 <script src="/resources/testharnessreport.js"></script> 9 <script src="/resources/testdriver.js"></script> 10 <script src="/resources/testdriver-actions.js"></script> 11 <script src="/resources/testdriver-vendor.js"></script> 12 <style> 13 #target 14 { 15 background-color: green; 16 width: 200px; 17 height: 200px; 18 } 19 </style> 20 </head> 21 <body> 22 <p>Double-click on the green box with the left mouse button.</p> 23 <div id="target"></div> 24 <script> 25 promise_test(async (t) => { 26 const target = document.getElementById("target"); 27 const event_watcher = new EventWatcher(t, target, ["click", "dblclick"]); 28 const actions_promise = new test_driver.Actions() 29 .pointerMove(0, 0, {origin: target}) 30 .pointerDown() 31 .pointerUp() 32 .pointerDown() 33 .pointerUp() 34 .send(); 35 // Make sure the test finishes after all the input actions are completed. 36 t.add_cleanup(() => actions_promise); 37 const event = await event_watcher.wait_for(["click", "click", "dblclick"]); 38 assert_equals(event.type, "dblclick"); 39 assert_equals(event.target, target); 40 assert_equals(event.detail, 2); 41 }); 42 </script> 43 </body> 44 </html>