tor-browser

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

selection-direction-on-triple-click.tentative.html (1490B)


      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    container.innerHTML = 'hello, world';
     21    const tripleClick = new test_driver.Actions()
     22      .pointerMove(0, 0, container.firstChild)
     23      .pointerDown()
     24      .pointerUp()
     25      .pointerDown()
     26      .pointerUp()
     27      .pointerDown()
     28      .pointerUp()
     29      .send();
     30    await tripleClick;
     31 
     32    const sel = getSelection();
     33    assert_equals(sel.anchorNode, container);
     34    assert_equals(sel.anchorOffset, 0);
     35    assert_equals(sel.focusNode, container);
     36    assert_equals(sel.focusOffset, 1);
     37    assert_equals(sel.direction, 'none');
     38 }, 'direction returns "none" when there is a triple click selection(directionless)');
     39 
     40 </script>
     41 </body>
     42 </html>