interactionid-keyboard-event-simulated-click-button-space.html (1313B)
1 <!DOCTYPE html> 2 <html> 3 <meta charset=utf-8 /> 4 <title>Event Timing: Keyboard event simulated click</title> 5 <meta charset=utf-8 /> 6 <script src=/resources/testharness.js></script> 7 <script src=/resources/testharnessreport.js></script> 8 <script src=/resources/testdriver.js></script> 9 <script src=/resources/testdriver-vendor.js></script> 10 <script src=resources/event-timing-test-utils.js></script> 11 12 <button id='button'>Click me.</button> 13 14 <script> 15 promise_test(async t => { 16 assert_implements(window.PerformanceEventTiming, 'Event Timing is not supported.'); 17 let map = new Map(); 18 19 const button = document.getElementById('button'); 20 21 const callback = (entryList) => { entryList.getEntries().filter(filterAndAddToMap(['keydown','click'], map)); }; 22 23 const readyToResolve = () => { return map.has('keydown') && map.has('click'); }; 24 25 const observerPromise = createPerformanceObserverPromise(['event'], callback, readyToResolve); 26 await interactAndObserve('space-key-simulated-click', button, observerPromise); 27 28 assert_equals(map.get('click'), map.get('keydown'), 29 'Click event should have the same interaction id as the keydown event.'); 30 31 }, 'Click event triggered by space key in checkbox should have the same\ 32 interaction id as that of the associated keyboard events.'); 33 </script>