activation-trigger-mouse-left.html (1554B)
1 <!DOCTYPE html> 2 <html> 3 <head> 4 <link rel="help" href="https://html.spec.whatwg.org/multipage/interaction.html#activation-triggering-input-event"> 5 <script src="/resources/testharness.js"></script> 6 <script src="/resources/testharnessreport.js"></script> 7 <script src="/resources/testdriver.js"></script> 8 <script src="/resources/testdriver-vendor.js"></script> 9 <script src="resources/utils.js"></script> 10 </head> 11 <body onload="runTests()"> 12 <h1>Test for click activation trigger</h1> 13 <p>Tests user activation from a mouse click.</p> 14 <ol id="instructions"> 15 <li>Click anywhere in the document. 16 </ol> 17 <script> 18 function runTests() { 19 promise_test(async () => { 20 21 let mousedown_event = getEvent('mousedown'); 22 let mouseup_event = getEvent('mouseup'); 23 let click_event = getEvent('click'); 24 25 await test_driver.click(document.body); 26 27 await mousedown_event; 28 let consumed = await consumeTransientActivation(); 29 assert_true(consumed, 30 "mousedown event should result in activation"); 31 32 await mouseup_event; 33 consumed = await consumeTransientActivation(); 34 assert_false(consumed, 35 "mouseup should have no activation after mousedown consumption"); 36 37 await click_event; 38 consumed = await consumeTransientActivation(); 39 assert_false(consumed, 40 "click should have no activation after mousedown consumption"); 41 }, "Activation through left-click mouse event"); 42 } 43 </script> 44 </body> 45 </html>