editor/libeditor/base/tests/test_bug567213.html

branch
TOR_BUG_3246
changeset 7
129ffea94266
equal deleted inserted replaced
-1:000000000000 0:18818ee4dcc2
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=567213
5 -->
6
7 <head>
8 <title>Test for Bug 567213</title>
9 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
10 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
11 <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
12 </head>
13
14 <body>
15 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=567213">Mozilla Bug 567213</a>
16 <p id="display"></p>
17 <div id="content">
18 <div id="target" contenteditable="true">test</div>
19 <button id="thief">theif</button>
20 </div>
21
22 <pre id="test">
23 <script type="application/javascript">
24
25 /** Test for Bug 567213 **/
26
27 SimpleTest.waitForExplicitFinish();
28
29 addLoadEvent(function() {
30 var target = document.getElementById("target");
31 var thief = document.getElementById("thief");
32 var sel = window.getSelection();
33
34 // select the contents of the editable area
35 sel.removeAllRanges();
36 sel.selectAllChildren(target);
37 target.focus();
38
39 // press some key
40 synthesizeKey("X", {});
41 is(target.textContent, "X", "Text input should work (sanity check)");
42
43 // select the contents of the editable area again
44 sel.removeAllRanges();
45 sel.selectAllChildren(target);
46 thief.focus();
47
48 // press some key with the thief having focus
49 synthesizeKey("Y", {});
50 is(target.textContent, "X", "Text entry should not work with another element focused");
51
52 SimpleTest.finish();
53 });
54
55 </script>
56 </pre>
57 </body>
58 </html>

mercurial