tor-browser

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

paste-with-newline-three-times.html (1550B)


      1 <!DOCTYPE html>
      2 <meta charset="utf-8" />
      3 <script src="/resources/testharness.js"></script>
      4 <script src="/resources/testharnessreport.js"></script>
      5 <script src="/resources/testdriver.js"></script>
      6 <script src="/resources/testdriver-vendor.js"></script>
      7 <script src="/resources/testdriver-actions.js"></script>
      8 <script src="../include/editor-test-utils.js"></script>
      9 <textarea id="copy">test
     10 </textarea>
     11 <textarea id="paste"></textarea>
     12 <textarea id="target"></textarea>
     13 <script>
     14  promise_test(async () => {
     15    const range = document.createRange();
     16    const contentToCopy = document.getElementById("copy");
     17    range.selectNodeContents(contentToCopy);
     18    const selection = window.getSelection();
     19    selection.removeAllRanges();
     20    selection.addRange(range);
     21    // Send copy command
     22    let utils = new EditorTestUtils(contentToCopy);
     23    await utils.sendCopyShortcutKey();
     24    selection.removeAllRanges();
     25 
     26    const textarea = document.getElementById("paste");
     27    utils = new EditorTestUtils(textarea);
     28    textarea.focus();
     29    // Send paste command three times
     30    await utils.sendPasteShortcutKey();
     31    await utils.sendPasteShortcutKey();
     32    await utils.sendPasteShortcutKey();
     33 
     34    // Type "end"
     35    await utils.sendKey("e", utils.kShiftKey);
     36    await utils.sendKey("n", utils.kShiftKey);
     37    await utils.sendKey("d", utils.kShiftKey);
     38 
     39    assert_equals(textarea.value.substr(textarea.value.length - 3), "end");
     40  }, "Pasting three times content with a newline at the end, the insertion caret keeps positioned at the end.");
     41 </script>