<!DOCTYPE html>
<html>
<meta charset=utf-8 />
<title>Event Timing: Keyboard event simulated click</title>
<meta charset=utf-8 />
<script src=/resources/testharness.js></script>
<script src=/resources/testharnessreport.js></script>
<script src=/resources/testdriver.js></script>
<script src=/resources/testdriver-vendor.js></script>
<script src=resources/event-timing-test-utils.js></script>
<input type="checkbox">
<script>
promise_test(async t => {
let map = new Map();
const checkbox = document.querySelector('input[type="checkbox"]');
const callback = (entryList) => { entryList.getEntries().filter(filterAndAddToMap(['keydown','click'], map)); };
const readyToResolve = () => { return map.has('keydown') && map.has('click'); };
const observerPromise = createPerformanceObserverPromise(['event'], callback, readyToResolve);
await interactAndObserve('space-key-simulated-click', checkbox, observerPromise );
assert_equals(map.get('click'), map.get('keydown'),
'Click event should have the same interaction id as the keydown event.');
}, 'Click event triggered by space key in checkbox should have the same\
interaction id as that of the associated keyboard events.');
</script>