test_bug645914.html (2293B)
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 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=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"> 21 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); 27 }); 28 function startTest() { 29 var textarea = document.querySelector("textarea"); 30 textarea.selectionStart = textarea.selectionEnd = 0; 31 32 // Simulate a double click on foo 33 synthesizeMouse(textarea, 5, 5, {clickCount: 2}); 34 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"); 38 39 textarea.selectionStart = textarea.selectionEnd = 0; 40 41 // Simulate a triple click on foo 42 synthesizeMouse(textarea, 5, 5, {clickCount: 3}); 43 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"); 47 48 textarea.selectionStart = textarea.selectionEnd = 0; 49 textarea.value = "Very very long value which would eventually overflow the visible section of the textarea"; 50 51 // Simulate a quadruple click on Very 52 synthesizeMouse(textarea, 5, 5, {clickCount: 4}); 53 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"); 57 58 SimpleTest.finish(); 59 } 60 </script> 61 </pre> 62 </body> 63 </html>