on-popover-disconnect.html (1146B)
1 <!doctype html> 2 <meta charset="utf-8" /> 3 <meta name="author" title="Keith Cirkel" href="mailto:wpt@keithcirkel.co.uk" /> 4 <meta name="timeout" content="long"> 5 <link rel="help" href="https://open-ui.org/components/invokers.explainer/" /> 6 <script src="/resources/testharness.js"></script> 7 <script src="/resources/testharnessreport.js"></script> 8 <script src="resources/invoker-utils.js"></script> 9 10 <div id="invokee" popover></div> 11 <button id="invokerbutton" commandfor="invokee" command="show-popover"></button> 12 13 <script> 14 const invokee = document.getElementById('invokee'); 15 test( 16 function (t) { 17 assert_false(invokee.matches(":popover-open"), "invokee :popover-open"); 18 let fired = false; 19 invokee.addEventListener('command', () => { 20 fired = true; 21 invokee.remove(); 22 }); 23 invokerbutton.click(); 24 assert_true(fired, "command event fired"); 25 assert_false(invokee.isConnected, "popover no longer connected"); 26 assert_false(invokee.matches(":popover-open"), "invokee :popover-open"); 27 }, 28 `invoking a popover and removing during command event does not raise an error`, 29 ); 30 </script>