editor/libeditor/base/tests/test_bug567213.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/base/tests/test_bug567213.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,58 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=567213
     1.8 +-->
     1.9 +
    1.10 +<head>
    1.11 +  <title>Test for Bug 567213</title>
    1.12 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    1.14 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.15 +</head>
    1.16 +
    1.17 +<body>
    1.18 +  <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=567213">Mozilla Bug 567213</a>
    1.19 +  <p id="display"></p>
    1.20 +  <div id="content">
    1.21 +    <div id="target" contenteditable="true">test</div>
    1.22 +    <button id="thief">theif</button>
    1.23 +  </div>
    1.24 +
    1.25 +  <pre id="test">
    1.26 +    <script type="application/javascript">
    1.27 +
    1.28 +      /** Test for Bug 567213 **/
    1.29 +
    1.30 +      SimpleTest.waitForExplicitFinish();
    1.31 +
    1.32 +      addLoadEvent(function() {
    1.33 +        var target = document.getElementById("target");
    1.34 +        var thief = document.getElementById("thief");
    1.35 +        var sel = window.getSelection();
    1.36 +
    1.37 +        // select the contents of the editable area
    1.38 +        sel.removeAllRanges();
    1.39 +        sel.selectAllChildren(target);
    1.40 +        target.focus();
    1.41 +
    1.42 +        // press some key
    1.43 +        synthesizeKey("X", {});
    1.44 +        is(target.textContent, "X", "Text input should work (sanity check)");
    1.45 +
    1.46 +        // select the contents of the editable area again
    1.47 +        sel.removeAllRanges();
    1.48 +        sel.selectAllChildren(target);
    1.49 +        thief.focus();
    1.50 +
    1.51 +        // press some key with the thief having focus
    1.52 +        synthesizeKey("Y", {});
    1.53 +        is(target.textContent, "X", "Text entry should not work with another element focused");
    1.54 +
    1.55 +        SimpleTest.finish();
    1.56 +      });
    1.57 +
    1.58 +   </script>
    1.59 +  </pre>
    1.60 +</body>
    1.61 +</html>

mercurial