tor-browser

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

accesskey.tentative.html (1351B)


      1 <!DOCTYPE html>
      2 <html>
      3 <head>
      4 <title>Shadow DOM: accesskey</title>
      5 <script src="/resources/testharness.js"></script>
      6 <script src="/resources/testharnessreport.js"></script>
      7 <script src="resources/shadow-dom.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/accesskey.js"></script>
     12 </head>
     13 <body>
     14 <div id="log"></div>
     15 <div id="container" style="position: relative"></div>
     16 <script>
     17 
     18 const container = document.getElementById('container');
     19 
     20 function testAccesskeyInShadowTree(mode) {
     21  promise_test(async t => {
     22    const host = document.createElement('div');
     23    container.appendChild(host);
     24    t.add_cleanup(() => host.remove());
     25 
     26    const shadowRoot = host.attachShadow({mode});
     27    shadowRoot.innerHTML = '<button id="button" accesskey="g">Click Me with Shift+Alt+g or on Mac with Control+Option+g</button>';
     28 
     29    let el = shadowRoot.getElementById("button");
     30    let eventWatcher = new EventWatcher(t, el, ['click']);
     31    let waitForClick = eventWatcher.wait_for('click');
     32 
     33    await pressAccessKey("g");
     34    await waitForClick;
     35  }, `button element with accesskey in the shadow tree of ${mode} mode`);
     36 }
     37 
     38 testAccesskeyInShadowTree("open");
     39 testAccesskeyInShadowTree("closed");
     40 
     41 </script>
     42 </body>