tor-browser

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

on-details-invalid-behavior.tentative.html (1658B)


      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/testdriver.js"></script>
      9 <script src="/resources/testdriver-actions.js"></script>
     10 <script src="/resources/testdriver-vendor.js"></script>
     11 <script src="resources/invoker-utils.js"></script>
     12 
     13 <details id="invokee">Details Contents</details>
     14 <button id="invokerbutton" commandfor="invokee" command="open"></button>
     15 
     16 <script>
     17  function resetState() {
     18    invokerbutton.removeAttribute("command");
     19    invokee.removeAttribute("open");
     20  }
     21 
     22  // invalid actions on details
     23  [
     24    "",
     25    "foo-bar",
     26    "show-popover",
     27    "show-modal",
     28    "show-picker",
     29    "hide-popover",
     30    "hide",
     31    "toggle-open",
     32  ].forEach((command) => {
     33    promise_test(async function (t) {
     34      t.add_cleanup(resetState);
     35      invokerbutton.command = command;
     36      assert_false(invokee.matches("[open]"));
     37      await clickOn(invokerbutton);
     38      assert_false(invokee.matches("[open]"));
     39    }, `invoking (as ${command}) on details does nothing`);
     40 
     41    promise_test(async function (t) {
     42      t.add_cleanup(resetState);
     43      invokerbutton.command = command;
     44      invokee.setAttribute("open", "");
     45      assert_true(invokee.matches("[open]"));
     46      await clickOn(invokerbutton);
     47      assert_true(invokee.matches("[open]"));
     48    }, `invoking (as ${command}) on open details does nothing`);
     49  });
     50 </script>