nnn-CloseWatcher-dialog-popover.html (1615B)
1 <!DOCTYPE html> 2 <link rel=author href="mailto:jarhar@chromium.org"> 3 <link rel=help href="https://github.com/whatwg/html/pull/9462"> 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 <script src="/resources/testdriver-actions.js"></script> 9 <script src="/common/top-layer.js"></script> 10 <script src="../resources/helpers.js"></script> 11 12 <button id=b0>button</button> 13 14 <dialog id=dialog> 15 <button id=b1>button</button> 16 <div id=popover popover=auto>popover</div> 17 </dialog> 18 19 <script> 20 promise_test(async t => { 21 const events = []; 22 const closeWatcher = createRecordingCloseWatcher(t, events, 'CloseWatcher', 'CloseWatcher'); 23 const dialog = createRecordingCloseWatcher(t, events, 'dialog', 'dialog'); 24 const popover = createRecordingCloseWatcher(t, events, 'popover', 'popover'); 25 assert_true(dialog.hasAttribute('open'), 'The dialog should be open.'); 26 assert_true(popover.matches(':popover-open'), 'The popover should be open.'); 27 28 await sendCloseRequest(); 29 await waitForPotentialCloseEvent(); 30 31 assert_false(popover.matches(':popover-open'), 'The popover should be closed.'); 32 assert_false(dialog.hasAttribute('open'), 'The dialog should be closed.'); 33 assert_array_equals(events, ['dialog cancel[cancelable=false]', 'CloseWatcher cancel[cancelable=false]', 'CloseWatcher close', 'dialog close']); 34 }, 'Create a CloseWatcher without user activation; create a dialog without user activation; create a popover without user activation'); 35 </script>