tor-browser

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

test_bug1655135.html (2300B)


      1 <!DOCTYPE HTML>
      2 <html>
      3 <!--
      4 https://bugzilla.mozilla.org/show_bug.cgi?id=1655135
      5 -->
      6 <head>
      7  <title>Test for Bug 1655135</title>
      8  <script src="/tests/SimpleTest/SimpleTest.js"></script>
      9  <script src="/tests/SimpleTest/EventUtils.js"></script>
     10  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
     11 </head>
     12 <body>
     13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=1655135">Mozilla Bug 1655135</a>
     14 <p id="display"></p>
     15 <div id="content">
     16 <textarea style="white-space: pre-line">foo
     17 bar</textarea>
     18 </div>
     19 <pre id="test">
     20 <script type="application/javascript">
     21 
     22 SimpleTest.waitForExplicitFinish();
     23 SimpleTest.waitForFocus(function() {
     24  SpecialPowers.pushPrefEnv({"set": [["layout.word_select.eat_space_to_next_word", true],
     25                                     ["browser.triple_click_selects_paragraph", false]]}, startTest);
     26 });
     27 function startTest() {
     28  var textarea = document.querySelector("textarea");
     29  textarea.selectionStart = textarea.selectionEnd = 0;
     30 
     31  // Simulate a double click on foo
     32  synthesizeMouse(textarea, 5, 5, {clickCount: 2});
     33 
     34  ok(true, "Testing word selection");
     35  is(textarea.selectionStart, 0, "The start of the selection should be at the beginning of the text");
     36  is(textarea.selectionEnd, 3, "The end of the selection should not include a newline character");
     37 
     38  textarea.selectionStart = textarea.selectionEnd = 0;
     39 
     40  // Simulate a triple click on foo
     41  synthesizeMouse(textarea, 5, 5, {clickCount: 3});
     42 
     43  ok(true, "Testing line selection");
     44  is(textarea.selectionStart, 0, "The start of the selection should be at the beginning of the text");
     45  is(textarea.selectionEnd, 3, "The end of the selection should not include a newline character");
     46 
     47  textarea.selectionStart = textarea.selectionEnd = 0;
     48  textarea.value = "Very very long value which would eventually overflow the visible section of the textarea";
     49 
     50  // Simulate a quadruple click on Very
     51  synthesizeMouse(textarea, 5, 5, {clickCount: 4});
     52 
     53  ok(true, "Testing paragraph selection");
     54  is(textarea.selectionStart, 0, "The start of the selection should be at the beginning of the text");
     55  is(textarea.selectionEnd, textarea.value.length, "The end of the selection should be the end of the paragraph");
     56 
     57  SimpleTest.finish();
     58 }
     59 </script>
     60 </pre>
     61 </body>
     62 </html>