Wed, 31 Dec 2014 06:55:50 +0100
Added tag UPSTREAM_283F7C6 for changeset ca08bd8f51b2
1 <!DOCTYPE HTML>
2 <!-- This Source Code Form is subject to the terms of the Mozilla Public
3 - License, v. 2.0. If a copy of the MPL was not distributed with this file,
4 - You can obtain one at http://mozilla.org/MPL/2.0/. -->
5 <html>
6 <!--
7 https://bugzilla.mozilla.org/show_bug.cgi?id=578771
8 -->
10 <head>
11 <title>Test for Bug 578771</title>
12 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
13 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
14 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
15 </head>
17 <body>
18 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=578771">Mozilla Bug 578771</a>
19 <p id="display"></p>
20 <div id="content" style="display: none">
21 </div>
23 <pre id="test">
24 <script type="application/javascript">
26 /** Test for Bug 578771 **/
27 SimpleTest.waitForExplicitFinish();
29 // Avoid platform selection differences
30 SpecialPowers.setBoolPref("layout.word_select.eat_space_to_next_word", false);
32 function testElem(elem, elemTag) {
33 var ce = document.getElementById("ce");
34 ce.focus();
36 synthesizeMouse(elem, 5, 5, {clickCount: 2 });
37 ok(elem.selectionStart == 0 && elem.selectionEnd == 7,
38 " Double-clicking on another " + elemTag + " works correctly");
40 ce.focus();
41 synthesizeMouse(elem, 5, 5, {clickCount: 3 });
42 ok(elem.selectionStart == 0 && elem.selectionEnd == 14,
43 "Triple-clicking on another " + elemTag + " works correctly");
44 }
46 SimpleTest.waitForFocus(function() {
47 var input = document.getElementById("ip");
48 testElem(input, "input");
50 var textarea = document.getElementById("ta");
51 testElem(textarea, "textarea");
53 SpecialPowers.clearUserPref("layout.word_select.eat_space_to_next_word");
54 SimpleTest.finish();
55 });
56 </script>
57 </pre>
59 <input id="ip" type="text" value="Mozilla editor" />
60 <textarea id="ta">Mozilla editor</textarea>
61 <div id="ce" contenteditable="true">Contenteditable div that could interfere with focus</div>
62 </body>
63 </html>