tor-browser

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

selection-direction-on-double-click.tentative.html (1439B)


      1 <!DOCTYPE html>
      2 <html>
      3 <body>
      4 <meta name="author" title="Sean Feng" href="mailto:sean@seanfeng.dev">
      5 <meta name="assert" content="Selection on clicks: direction should return none, forwad, or backward">
      6 <link rel="help" href="https://w3c.github.io/selection-api/#dom-selection-direction">
      7 <link rel="help" href="https://github.com/w3c/selection-api/issues/177">
      8 <script src="/resources/testharness.js"></script>
      9 <script src="/resources/testharnessreport.js"></script>
     10 <script src="/resources/testdriver.js"></script>
     11 <script src="/resources/testdriver-actions.js"></script>
     12 <script src='/resources/testdriver-vendor.js'></script>
     13 <div id="container">hello, world</div>
     14 <script>
     15 
     16 // Note: This test should remain tentative until Selection API issue 177 is
     17 // resolved and direction for clicks are specified.
     18 
     19 promise_test(async () => {
     20    const doubleClick = new test_driver.Actions()
     21      .pointerMove(0, 0, container.firstChild)
     22      .pointerDown()
     23      .pointerUp()
     24      .pointerDown()
     25      .pointerUp()
     26      .send();
     27    await doubleClick;
     28 
     29    const sel = getSelection();
     30    assert_equals(sel.anchorNode, container.firstChild);
     31    assert_equals(sel.anchorOffset, 0);
     32    assert_equals(sel.focusNode, container.firstChild);
     33    assert_equals(sel.focusOffset, 5); // hello
     34    assert_equals(sel.direction, 'none');
     35 }, 'direction returns "none" when there is a double click selection(directionless)');
     36 
     37 </script>
     38 </body>
     39 </html>