Wed, 31 Dec 2014 06:09:35 +0100
Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=240933
5 -->
7 <head>
8 <title>Test for Bug 240933</title>
9 <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
10 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
11 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
12 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
13 </head>
15 <body>
16 <a target="_blank"
17 href="https://bugzilla.mozilla.org/show_bug.cgi?id=240933">
18 Mozilla Bug 240933
19 </a>
20 <p id="display"></p>
21 <div id="content" style="display: none">
22 </div>
24 <pre id="test">
25 <script type="application/javascript">
27 /** Test for Bug 240933 **/
29 SimpleTest.waitForExplicitFinish();
31 SimpleTest.waitForFocus(function() {
32 var t = document.getElementById("t");
33 synthesizeMouse(t, t.clientWidth / 2, 5, {}, window);
34 is(t.selectionStart, 3, "The selection should be set before the newline");
35 is(t.selectionEnd, 3, "The selection should be set before the newline");
37 t = document.getElementById("ta");
38 t.focus();
39 t.selectionStart = t.selectionEnd = t.value.length;
40 var val = t.value;
41 synthesizeKey("VK_RETURN", {});
42 is(t.value, val + "\n", "Pressing enter right after focusing the textarea should work");
44 t = document.getElementById("tb");
45 t.focus();
46 synthesizeKey("VK_RETURN", {});
47 is(t.value, "\n", "Pressing enter for the first time should work");
48 synthesizeKey("VK_RETURN", {});
49 is(t.value, "\n\n", "Pressing enter for the second time should work");
50 synthesizeKey("VK_BACK_SPACE", {});
51 is(t.value, "\n", "Pressing backspace for the first time should work");
52 synthesizeKey("VK_BACK_SPACE", {});
53 is(t.value, "", "Pressing backspace for the second time should work");
54 SimpleTest.finish();
55 });
57 </script>
58 </pre>
60 <textarea id="t" rows="10" cols="10">abc
61 </textarea>
62 <textarea id="ta" rows="10" cols="10">
63 test
65 </textarea>
66 <textarea id="tb" rows="10" cols="10"></textarea>
68 </body>
69 </html>