editor/libeditor/html/tests/test_bug578771.html

Thu, 22 Jan 2015 13:21:57 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Thu, 22 Jan 2015 13:21:57 +0100
branch
TOR_BUG_9701
changeset 15
b8a032363ba2
permissions
-rw-r--r--

Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6

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

mercurial