Bug 1772588 [wpt PR 34302] - [wpt] Add test for block-in-inline offsetParent., a...
[gecko.git] / editor / libeditor / tests / test_bug645914.html
blob8f1a8cbfdab6b28c3d0b83b73daaac6518ac6ecd
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">
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;
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");
58 SimpleTest.finish();
60 </script>
61 </pre>
62 </body>
63 </html>