editor/libeditor/base/tests/test_bug567213.html

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

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

mercurial