tor-browser

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

test_bug1102906.html (1509B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1102906
      5 -->
      6 <head>
      7  <meta charset="utf-8">
      8  <title>Test for Bug 1102906</title>
      9 
     10  <script src="/tests/SimpleTest/EventUtils.js"></script>
     11  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     12 
     13  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
     14 
     15  <script>
     16   "use strict";
     17 
     18  /* Test for Bug 1102906 */
     19  /* The caret should be movable by using keyboard after drag-and-drop. */
     20 
     21  SimpleTest.waitForExplicitFinish();
     22  SimpleTest.waitForFocus( () => {
     23    let content = document.getElementById("content");
     24    let drag = document.getElementById("drag");
     25    let selection = window.getSelection();
     26 
     27    /* Perform drag-and-drop for an arbitrary content. The caret should be at
     28       the end of the contenteditable. */
     29    selection.selectAllChildren(drag);
     30    synthesizeDrop(drag, content, {}, "copy");
     31 
     32    let textContentAfterDrop = content.textContent;
     33 
     34    /* Move the caret to the front of the contenteditable by using keyboard. */
     35    for (let i = 0; i < content.textContent.length; ++i) {
     36      sendKey("LEFT");
     37    }
     38    sendChar("!");
     39 
     40    is(content.textContent, "!" + textContentAfterDrop,
     41       "The exclamation mark should be inserted at the front.");
     42 
     43    SimpleTest.finish();
     44  });
     45  </script>
     46 </head>
     47 <body>
     48 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1102906">Mozilla Bug 1102906</a>
     49 <div id="content" contenteditable="true"><span id="drag">Drag</span></div>
     50 </body>
     51 </html>