tor-browser

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

test_texteditor_wrapping_long_line.html (1605B)


      1 <!DOCTYPE>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1733878
      5 -->
      6 <head>
      7  <meta charset="UTF-8" />
      8  <title>Test for bug 1733878</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 1733878 */
     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 = "> hello world this_is_a_very_long_long_word_which_has_a_length_higher_than_the_max_column";
     26      editor.rewrap(true);
     27      is(document.body.innerText, "> hello world\n> this_is_a_very_long_long_word_which_has_a_length_higher_than_the_max_column", "Rewrapped");
     28 
     29      SimpleTest.finish();
     30    });
     31  });
     32 
     33  function getEditor() {
     34    var Ci = SpecialPowers.Ci;
     35    var editingSession = SpecialPowers.wrap(window).docShell.editingSession;
     36    var editor = editingSession.getEditorForWindow(window);
     37    editor.QueryInterface(Ci.nsIHTMLEditor);
     38    editor.QueryInterface(Ci.nsIEditorMailSupport);
     39    editor.flags |= SpecialPowers.Ci.nsIEditor.eEditorPlaintextMask;
     40    return editor;
     41  }
     42  </script>
     43 </head>
     44 <body contenteditable></body>
     45 </html>