4 https://bugzilla.mozilla.org/show_bug.cgi?id=645914
7 <title>Test for Bug
645914</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"/>
13 <a target=
"_blank" href=
"https://bugzilla.mozilla.org/show_bug.cgi?id=645914">Mozilla Bug
645914</a>
20 <script type=
"application/javascript">
22 /** Test for Bug
645914 **/
23 SimpleTest.waitForExplicitFinish();
24 SimpleTest.waitForFocus(function() {
25 SpecialPowers.pushPrefEnv({
"set": [[
"layout.word_select.eat_space_to_next_word", true],
26 [
"browser.triple_click_selects_paragraph", false]]}, startTest);
28 function startTest() {
29 var textarea = document.querySelector(
"textarea");
30 textarea.selectionStart = textarea.selectionEnd =
0;
32 // Simulate a double click on foo
33 synthesizeMouse(textarea,
5,
5, {clickCount:
2});
35 ok(true,
"Testing word selection");
36 is(textarea.selectionStart,
0,
"The start of the selection should be at the beginning of the text");
37 is(textarea.selectionEnd,
3,
"The end of the selection should not include a newline character");
39 textarea.selectionStart = textarea.selectionEnd =
0;
41 // Simulate a triple click on foo
42 synthesizeMouse(textarea,
5,
5, {clickCount:
3});
44 ok(true,
"Testing line selection");
45 is(textarea.selectionStart,
0,
"The start of the selection should be at the beginning of the text");
46 is(textarea.selectionEnd,
3,
"The end of the selection should not include a newline character");
48 textarea.selectionStart = textarea.selectionEnd =
0;
49 textarea.value =
"Very very long value which would eventually overflow the visible section of the textarea";
51 // Simulate a quadruple click on Very
52 synthesizeMouse(textarea,
5,
5, {clickCount:
4});
54 ok(true,
"Testing paragraph selection");
55 is(textarea.selectionStart,
0,
"The start of the selection should be at the beginning of the text");
56 is(textarea.selectionEnd, textarea.value.length,
"The end of the selection should be the end of the paragraph");