yyy-popovers.html (1917B)
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 await test_driver.click(b0); 26 p1.showPopover(); 27 await test_driver.click(b1); 28 p2.showPopover(); 29 await test_driver.click(b2); 30 p3.showPopover(); 31 assert_true(p1.matches(':popover-open'), 'p1 should be open.'); 32 assert_true(p2.matches(':popover-open'), 'p2 should be open.'); 33 assert_true(p3.matches(':popover-open'), 'p3 should be open.'); 34 35 await sendCloseRequest(); 36 assert_true(p1.matches(':popover-open'), 'first escape: p1 should be open.'); 37 assert_true(p2.matches(':popover-open'), 'first escape: p2 should be open.'); 38 assert_false(p3.matches(':popover-open'), 'first escape: p3 should be closed.'); 39 40 await sendCloseRequest(); 41 assert_true(p1.matches(':popover-open'), 'second escape: p1 should be open.'); 42 assert_false(p2.matches(':popover-open'), 'second escape: p2 should be closed.'); 43 assert_false(p3.matches(':popover-open'), 'second escape: p3 should be closed.'); 44 45 await sendCloseRequest(); 46 assert_false(p1.matches(':popover-open'), 'third escape: p1 should be closed.'); 47 assert_false(p2.matches(':popover-open'), 'third escape: p2 should be closed.'); 48 assert_false(p3.matches(':popover-open'), 'third escape: p3 should be closed.'); 49 }, 'Create three popovers with user activation'); 50 </script>