tor-browser

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

test_bug1649005.html (1626B)


      1 <!DOCTYPE>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1649005
      5 -->
      6 <head>
      7  <meta charset="UTF-8" />
      8  <title>Test for bug 1649005</title>
      9  <script src="/tests/SimpleTest/SimpleTest.js"></script>
     10  <link rel="stylesheet" href="/tests/SimpleTest/test.css">
     11  <script src="/tests/SimpleTest/EventUtils.js"></script>
     12  <script>
     13  /** Test for bug 1649005, bug 1779343 */
     14  window.addEventListener("DOMContentLoaded", () => {
     15    SimpleTest.waitForExplicitFinish();
     16    SimpleTest.waitForFocus(function() {
     17      document.body.textContent = ""; // It would be \n\n otherwise...
     18      synthesizeMouseAtCenter(document.body, {});
     19 
     20      var editor = getEditor();
     21      is(document.body.textContent, "", "Initial body check");
     22      editor.rewrap(false);
     23      is(document.body.textContent, "", "Initial body check after rewrap");
     24 
     25      document.body.innerHTML = "&gt;abc<br/>&gt;def<br/>&gt;ghi";
     26      editor.rewrap(true);
     27      is(document.body.textContent, "> abc def ghi", "Rewrapped");
     28 
     29      document.body.innerHTML = "&gt; ";
     30      editor.rewrap(true);
     31      is(document.body.textContent, "> ", "Rewrapped half-empty string");
     32 
     33      SimpleTest.finish();
     34    });
     35  });
     36 
     37  function getEditor() {
     38    var Ci = SpecialPowers.Ci;
     39    var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
     40    var editor = editingSession.getEditorForWindow(window);
     41    editor.QueryInterface(Ci.nsIHTMLEditor);
     42    editor.QueryInterface(Ci.nsIEditorMailSupport);
     43    editor.flags |= SpecialPowers.Ci.nsIEditor.eEditorPlaintextMask;
     44    return editor;
     45  }
     46  </script>
     47 </head>
     48 <body contenteditable></body>
     49 </html>