editor/libeditor/text/tests/test_bug645914.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=645914
     5 -->
     6 <head>
     7   <title>Test for Bug 645914</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="text/javascript" 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=645914">Mozilla Bug 645914</a>
    14 <p id="display"></p>
    15 <div id="content">
    16 <textarea>foo
    17 bar</textarea>
    18 </div>
    19 <pre id="test">
    20 <script type="application/javascript">
    22 /** Test for Bug 645914 **/
    23 SimpleTest.waitForExplicitFinish();
    24 SimpleTest.waitForFocus(function() {
    25   var textarea = document.querySelector("textarea");
    26   SpecialPowers.setBoolPref("layout.word_select.eat_space_to_next_word", true);
    27   SpecialPowers.setBoolPref("browser.triple_click_selects_paragraph", false);
    29   textarea.selectionStart = textarea.selectionEnd = 0;
    31   // Simulate a double click on foo
    32   synthesizeMouse(textarea, 5, 5, {clickCount: 2});
    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");
    38   textarea.selectionStart = textarea.selectionEnd = 0;
    40   // Simulate a triple click on foo
    41   synthesizeMouse(textarea, 5, 5, {clickCount: 3});
    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");
    47   textarea.selectionStart = textarea.selectionEnd = 0;
    48   textarea.value = "Very very long value which would eventually overflow the visible section of the textarea";
    50   // Simulate a quadruple click on Very
    51   synthesizeMouse(textarea, 5, 5, {clickCount: 4});
    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");
    57   SpecialPowers.clearUserPref("layout.word_select.eat_space_to_next_word");
    58   SpecialPowers.clearUserPref("browser.triple_click_selects_paragraph");
    59   SimpleTest.finish();
    60 });
    62 </script>
    63 </pre>
    64 </body>
    65 </html>

mercurial