tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

popover-self-invoke.html (1393B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8">
      3 <link rel="author" href="mailto:masonf@chromium.org">
      4 <link rel=help href="https://html.spec.whatwg.org/multipage/popover.html">
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="/resources/testdriver.js"></script>
      8 <script src="/resources/testdriver-actions.js"></script>
      9 <script src="/resources/testdriver-vendor.js"></script>
     10 <script src="resources/popover-utils.js"></script>
     11 
     12 <button popover id="lock" popovertarget="lock" style="display: inline">
     13  Tapping this should not hang
     14 </button>
     15 
     16 <script>
     17 const button = document.getElementById('lock');
     18 function runTest(activator, description) {
     19  promise_test(async t => {
     20    assert_false(button.matches(':popover-open'), 'Button should not be open initially');
     21    await activator();
     22    assert_true(button.matches(':popover-open'), 'Button should be open after touch');
     23    button.hidePopover(); // Cleanup
     24    assert_false(button.matches(':popover-open'), 'Cleanup should close the popover');
     25  }, `${description} on a popover button that is its own target should open it.`);
     26 }
     27 // Try with both mouse and touchscreen, via test_driver.Actions()
     28 ['mouse','touch'].forEach((method) => {
     29  runTest(() => clickOn(button, method === 'touch'), method);
     30 });
     31 // Also try programmatic click.
     32 runTest(() => button.click(), 'click');
     33 </script>