1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/editor/libeditor/text/tests/test_bug645914.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=645914 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 645914</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.13 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.14 +</head> 1.15 +<body> 1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=645914">Mozilla Bug 645914</a> 1.17 +<p id="display"></p> 1.18 +<div id="content"> 1.19 +<textarea>foo 1.20 +bar</textarea> 1.21 +</div> 1.22 +<pre id="test"> 1.23 +<script type="application/javascript"> 1.24 + 1.25 +/** Test for Bug 645914 **/ 1.26 +SimpleTest.waitForExplicitFinish(); 1.27 +SimpleTest.waitForFocus(function() { 1.28 + var textarea = document.querySelector("textarea"); 1.29 + SpecialPowers.setBoolPref("layout.word_select.eat_space_to_next_word", true); 1.30 + SpecialPowers.setBoolPref("browser.triple_click_selects_paragraph", false); 1.31 + 1.32 + textarea.selectionStart = textarea.selectionEnd = 0; 1.33 + 1.34 + // Simulate a double click on foo 1.35 + synthesizeMouse(textarea, 5, 5, {clickCount: 2}); 1.36 + 1.37 + ok(true, "Testing word selection"); 1.38 + is(textarea.selectionStart, 0, "The start of the selection should be at the beginning of the text"); 1.39 + is(textarea.selectionEnd, 3, "The end of the selection should not include a newline character"); 1.40 + 1.41 + textarea.selectionStart = textarea.selectionEnd = 0; 1.42 + 1.43 + // Simulate a triple click on foo 1.44 + synthesizeMouse(textarea, 5, 5, {clickCount: 3}); 1.45 + 1.46 + ok(true, "Testing line selection"); 1.47 + is(textarea.selectionStart, 0, "The start of the selection should be at the beginning of the text"); 1.48 + is(textarea.selectionEnd, 3, "The end of the selection should not include a newline character"); 1.49 + 1.50 + textarea.selectionStart = textarea.selectionEnd = 0; 1.51 + textarea.value = "Very very long value which would eventually overflow the visible section of the textarea"; 1.52 + 1.53 + // Simulate a quadruple click on Very 1.54 + synthesizeMouse(textarea, 5, 5, {clickCount: 4}); 1.55 + 1.56 + ok(true, "Testing paragraph selection"); 1.57 + is(textarea.selectionStart, 0, "The start of the selection should be at the beginning of the text"); 1.58 + is(textarea.selectionEnd, textarea.value.length, "The end of the selection should be the end of the paragraph"); 1.59 + 1.60 + SpecialPowers.clearUserPref("layout.word_select.eat_space_to_next_word"); 1.61 + SpecialPowers.clearUserPref("browser.triple_click_selects_paragraph"); 1.62 + SimpleTest.finish(); 1.63 +}); 1.64 + 1.65 +</script> 1.66 +</pre> 1.67 +</body> 1.68 +</html>