editor/libeditor/html/tests/test_bug578771.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/html/tests/test_bug578771.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,63 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<!-- This Source Code Form is subject to the terms of the Mozilla Public
     1.6 +   - License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.7 +   - You can obtain one at http://mozilla.org/MPL/2.0/.  -->
     1.8 +<html>
     1.9 +<!--
    1.10 +https://bugzilla.mozilla.org/show_bug.cgi?id=578771
    1.11 +-->
    1.12 +
    1.13 +<head>
    1.14 +  <title>Test for Bug 578771</title>
    1.15 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.16 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.17 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>  
    1.18 +</head>
    1.19 +
    1.20 +<body>
    1.21 +  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=578771">Mozilla Bug 578771</a>
    1.22 +  <p id="display"></p>
    1.23 +  <div id="content" style="display: none">
    1.24 +  </div>
    1.25 +
    1.26 +  <pre id="test">
    1.27 +    <script type="application/javascript">
    1.28 +
    1.29 +      /** Test for Bug 578771 **/
    1.30 +      SimpleTest.waitForExplicitFinish();
    1.31 +
    1.32 +      // Avoid platform selection differences
    1.33 +      SpecialPowers.setBoolPref("layout.word_select.eat_space_to_next_word", false);
    1.34 +
    1.35 +      function testElem(elem, elemTag) {
    1.36 +        var ce = document.getElementById("ce");
    1.37 +        ce.focus();
    1.38 +
    1.39 +        synthesizeMouse(elem, 5, 5, {clickCount: 2 });   
    1.40 +        ok(elem.selectionStart == 0 && elem.selectionEnd == 7,
    1.41 +           " Double-clicking on another " + elemTag + " works correctly");
    1.42 +
    1.43 +        ce.focus();
    1.44 +        synthesizeMouse(elem, 5, 5, {clickCount: 3 });   
    1.45 +        ok(elem.selectionStart == 0 && elem.selectionEnd == 14,
    1.46 +           "Triple-clicking on another " + elemTag + " works correctly");
    1.47 +      }
    1.48 +
    1.49 +      SimpleTest.waitForFocus(function() {
    1.50 +        var input = document.getElementById("ip");
    1.51 +        testElem(input, "input");
    1.52 +
    1.53 +        var textarea = document.getElementById("ta");
    1.54 +        testElem(textarea, "textarea");
    1.55 +
    1.56 +        SpecialPowers.clearUserPref("layout.word_select.eat_space_to_next_word");
    1.57 +        SimpleTest.finish();
    1.58 +      });
    1.59 +   </script>
    1.60 +  </pre>
    1.61 +
    1.62 +  <input id="ip" type="text" value="Mozilla editor" />
    1.63 +  <textarea id="ta">Mozilla editor</textarea>
    1.64 +  <div id="ce" contenteditable="true">Contenteditable div that could interfere with focus</div>
    1.65 +</body>
    1.66 +</html>

mercurial