layout/generic/test/test_bug240933.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=240933
michael@0 5 -->
michael@0 6
michael@0 7 <head>
michael@0 8 <title>Test for Bug 240933</title>
michael@0 9 <script type="application/javascript" src="/MochiKit/MochiKit.js"></script>
michael@0 10 <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
michael@0 11 <script type="application/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
michael@0 12 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
michael@0 13 </head>
michael@0 14
michael@0 15 <body>
michael@0 16 <a target="_blank"
michael@0 17 href="https://bugzilla.mozilla.org/show_bug.cgi?id=240933">
michael@0 18 Mozilla Bug 240933
michael@0 19 </a>
michael@0 20 <p id="display"></p>
michael@0 21 <div id="content" style="display: none">
michael@0 22 </div>
michael@0 23
michael@0 24 <pre id="test">
michael@0 25 <script type="application/javascript">
michael@0 26
michael@0 27 /** Test for Bug 240933 **/
michael@0 28
michael@0 29 SimpleTest.waitForExplicitFinish();
michael@0 30
michael@0 31 SimpleTest.waitForFocus(function() {
michael@0 32 var t = document.getElementById("t");
michael@0 33 synthesizeMouse(t, t.clientWidth / 2, 5, {}, window);
michael@0 34 is(t.selectionStart, 3, "The selection should be set before the newline");
michael@0 35 is(t.selectionEnd, 3, "The selection should be set before the newline");
michael@0 36
michael@0 37 t = document.getElementById("ta");
michael@0 38 t.focus();
michael@0 39 t.selectionStart = t.selectionEnd = t.value.length;
michael@0 40 var val = t.value;
michael@0 41 synthesizeKey("VK_RETURN", {});
michael@0 42 is(t.value, val + "\n", "Pressing enter right after focusing the textarea should work");
michael@0 43
michael@0 44 t = document.getElementById("tb");
michael@0 45 t.focus();
michael@0 46 synthesizeKey("VK_RETURN", {});
michael@0 47 is(t.value, "\n", "Pressing enter for the first time should work");
michael@0 48 synthesizeKey("VK_RETURN", {});
michael@0 49 is(t.value, "\n\n", "Pressing enter for the second time should work");
michael@0 50 synthesizeKey("VK_BACK_SPACE", {});
michael@0 51 is(t.value, "\n", "Pressing backspace for the first time should work");
michael@0 52 synthesizeKey("VK_BACK_SPACE", {});
michael@0 53 is(t.value, "", "Pressing backspace for the second time should work");
michael@0 54 SimpleTest.finish();
michael@0 55 });
michael@0 56
michael@0 57 </script>
michael@0 58 </pre>
michael@0 59
michael@0 60 <textarea id="t" rows="10" cols="10">abc
michael@0 61 </textarea>
michael@0 62 <textarea id="ta" rows="10" cols="10">
michael@0 63 test
michael@0 64
michael@0 65 </textarea>
michael@0 66 <textarea id="tb" rows="10" cols="10"></textarea>
michael@0 67
michael@0 68 </body>
michael@0 69 </html>

mercurial