keydown.html (663B)
1 <!doctype html> 2 <script src="/resources/testharness.js"></script> 3 <script src="/resources/testharnessreport.js"></script> 4 <script src="/resources/testdriver.js"></script> 5 <script src="/resources/testdriver-vendor.js"></script> 6 <script src="/resources/testdriver-actions.js"></script> 7 <script src="../resources/helpers.js"></script> 8 9 <body> 10 <script> 11 promise_test(async t => { 12 let events = []; 13 let watcher = createRecordingCloseWatcher(t, events); 14 15 window.onkeydown = e => e.preventDefault(); 16 17 await sendEscKey(); 18 19 assert_array_equals(events, []); 20 }, "A keydown listener can prevent the Esc keypress from being interpreted as a close request"); 21 </script>