editor/libeditor/text/tests/test_bug596506.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.

     1 <!DOCTYPE HTML>
     2 <html>
     3 <!--
     4 https://bugzilla.mozilla.org/show_bug.cgi?id=596506
     5 -->
     6 <head>
     7   <title>Test for Bug 596506</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    10   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=596506">Mozilla Bug 596506</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    17 </div>
    18 <pre id="test">
    19 <script type="application/javascript">
    21 /** Test for Bug 596506 **/
    23 SimpleTest.waitForExplicitFinish();
    24 SimpleTest.waitForFocus(runTest);
    26 const kIsMac = navigator.platform.indexOf("Mac") == 0;
    28 function append(str) {
    29   for (var i = 0; i < str.length; ++i) {
    30     synthesizeKey(str[i], {});
    31   }
    32 }
    34 function runTest() {
    35   var edit = document.getElementById("edit");
    36   edit.focus();
    38   append("First");
    39   synthesizeKey("VK_RETURN", {});
    40   append("Second");
    41   synthesizeKey("VK_UP", {});
    42   synthesizeKey("VK_UP", {});
    43   if (kIsMac) {
    44     synthesizeKey("VK_RIGHT", {accelKey: true});
    45   } else {
    46     synthesizeKey("VK_END", {});
    47   }
    48   append("ly");
    49   is(edit.value, "Firstly\nSecond",
    50      "Pressing end should position the cursor before the terminating newline");
    51   SimpleTest.finish();
    52 }
    54 </script>
    55 </pre>
    57 <textarea id="edit"></textarea>
    59 </body>
    60 </html>

mercurial