editor/libeditor/text/tests/test_bug600570.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=600570
     5 -->
     6 <head>
     7   <title>Test for Bug 600570</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    10   <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script>
    11   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    12 </head>
    13 <body>
    14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=600570">Mozilla Bug 600570</a>
    15 <p id="display"></p>
    16 <div id="content">
    17 <textarea spellcheck="false">
    18 aaa
    19 [bbb]</textarea>
    20 </div>
    21 <pre id="test">
    22 <script type="application/javascript">
    24 /** Test for Bug 600570 **/
    26 // Bug 718316: This test fails on Windows 7 and 8
    27 if (navigator.userAgent.indexOf("Windows NT 6.1") == -1 &&
    28     navigator.userAgent.indexOf("Windows NT 6.2") == -1) {
    30 SimpleTest.waitForExplicitFinish();
    31 SimpleTest.waitForFocus(function() {
    32   var t = document.querySelector("textarea");
    33   t.value = "[aaa\nbbb]";
    34   t.focus();
    35   synthesizeKey("A", {accelKey: true});
    37   SimpleTest.executeSoon(function() {
    38     t.getBoundingClientRect(); // flush layout
    39     var afterSetValue = snapshotWindow(window);
    41     t.value = t.defaultValue;
    43     t.selectionStart = 0;
    44     t.selectionEnd = 4;
    45     SimpleTest.waitForClipboard("aaa\n",
    46       function() {
    47         synthesizeKey("X", {accelKey: true});
    48       },
    49       function() {
    50         t.addEventListener("input", function() {
    51           t.removeEventListener("input", arguments.callee, false);
    53           setTimeout(function() { // Avoid the assertion in bug 649797
    54             is(t.value, "[aaa\nbbb]", "The value of the textarea should be correct");
    55             synthesizeKey("A", {accelKey: true});
    56             is(t.selectionStart, 0, "Select all should set the selection start to the beginning of textarea");
    57             is(t.selectionEnd, 9, "Select all should set the selection end to the end of textarea");
    59             var afterPaste = snapshotWindow(window);
    61             var res = compareSnapshots(afterSetValue, afterPaste, true);
    62             var msg = "Pasting and setting the value directly should result in the same rendering";
    63             if (!res[0]) {
    64               msg += "\nRESULT:\n" + res[2] + "\nREFERENCE:\n" + res[1];
    65             }
    66             ok(res[0], msg);
    68             SimpleTest.finish();
    69           }, 0);
    70         }, false);
    71         synthesizeKey("VK_RIGHT", {});
    72         synthesizeKey("V", {accelKey: true});
    73       },
    74       function() {
    75         SimpleTest.finish();
    76       }
    77     );
    78   });
    79 });
    81 }
    82 else {
    83   ok(true, "Somebody thought it was a great idea to make me type this.");
    84 }
    86 </script>
    87 </pre>
    88 </body>
    89 </html>

mercurial