nyn-popovers.html (1662B)
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="../resources/helpers.js"></script> 10 11 <button id=b0>b0</button> 12 13 <div id=p1 popover=auto> 14 <button id=b1>b1</button> 15 16 <div id=p2 popover=auto> 17 <button id=b2>b2</button> 18 19 <div id=p3 popover=auto>p3</div> 20 </div> 21 </div> 22 23 <script> 24 promise_test(async () => { 25 p1.showPopover(); 26 await test_driver.click(b1); 27 p2.showPopover(); 28 p3.showPopover(); 29 assert_true(p1.matches(':popover-open'), 'p1 should be open.'); 30 assert_true(p2.matches(':popover-open'), 'p2 should be open.'); 31 assert_true(p3.matches(':popover-open'), 'p3 should be open.'); 32 33 await sendCloseRequest(); 34 assert_true(p1.matches(':popover-open'), 'first escape: p1 should be open.'); 35 assert_false(p2.matches(':popover-open'), 'first escape: p2 should be closed.'); 36 assert_false(p3.matches(':popover-open'), 'first escape: p3 should be closed.'); 37 38 await sendCloseRequest(); 39 assert_false(p1.matches(':popover-open'), 'second escape: p1 should be closed.'); 40 assert_false(p2.matches(':popover-open'), 'second escape: p2 should be closed.'); 41 assert_false(p3.matches(':popover-open'), 'second escape: p3 should be closed.'); 42 }, 'Create a popover without user activation; create a popover with user activation; create a popover without user activation'); 43 </script>