click-user-gesture.html (1186B)
1 <!DOCTYPE html> 2 <title>Test click() user gesture for pickers</title> 3 <meta name="timeout" content="long"> 4 <script src="/resources/testharness.js"></script> 5 <script src="/resources/testharnessreport.js"></script> 6 <script src="/resources/testdriver.js"></script> 7 <script src="/resources/testdriver-vendor.js"></script> 8 <body></body> 9 <script type=module> 10 import inputTypes from "./input-types.js"; 11 12 const pickerTypes = ['color', 'date', 'datetime-local', 'file', 'month', 'time', 'week']; 13 14 for (const inputType of pickerTypes) { 15 promise_test(async t => { 16 const input = document.createElement("input"); 17 input.setAttribute("type", inputType); 18 19 await test_driver.bless('click'); 20 input.click(); 21 input.blur(); 22 }, `input[type=${inputType}] click() does not throw when user activation is active`); 23 } 24 25 for (const inputType of pickerTypes) { 26 promise_test(async () => { 27 const input = document.createElement('input'); 28 input.setAttribute('type', inputType); 29 30 await test_driver.bless('click'); 31 input.click(); 32 input.blur(); 33 34 assert_false(navigator.userActivation.isActive); 35 }, `input[type=${inputType}] click() consumes user activation`); 36 } 37 </script>