editor/libeditor/text/tests/test_bug597331.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=597331
     5 -->
     6 <head>
     7   <title>Test for Bug 597331</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=597331">Mozilla Bug 597331</a>
    15 <p id="display"></p>
    16 <div id="content">
    17 <textarea>line1
    18 line2
    19 line3
    20 </textarea>
    21 </div>
    22 <pre id="test">
    23 <script type="application/javascript">
    25 /** Test for Bug 597331 **/
    27 // Bug 718316: This test fails on Windows 7 and 8
    28 if (navigator.userAgent.indexOf("Windows NT 6.1") == -1 &&
    29     navigator.userAgent.indexOf("Windows NT 6.2") == -1) {
    31 SimpleTest.waitForExplicitFinish();
    32 addLoadEvent(function() {
    33   SimpleTest.executeSoon(function() {
    34     var t = document.querySelector("textarea");
    35     t.focus();
    36     t.selectionStart = 4;
    37     t.selectionEnd = 4;
    38     SimpleTest.executeSoon(function() {
    39       t.getBoundingClientRect(); // flush layout
    40       var before = snapshotWindow(window, true);
    41       t.selectionStart = 5;
    42       t.selectionEnd = 5;
    43       t.addEventListener("keydown", function() {
    44         t.removeEventListener("keydown", arguments.callee, false);
    46         SimpleTest.executeSoon(function() {
    47           t.style.display = 'block';
    48           document.body.offsetWidth;
    49           t.style.display = '';
    50           document.body.offsetWidth;
    52           is(t.selectionStart, 4, "Cursor should be moved correctly");
    53           is(t.selectionEnd, 4, "Cursor should be moved correctly");
    55           var after = snapshotWindow(window, true);
    57           var result = compareSnapshots(before, after, true);
    58           var msg = "The caret should be displayed correctly after reframing";
    59           if (!result[0]) {
    60             msg += "\nRESULT:\n" + result[2];
    61             msg += "\nREFERENCE:\n" + result[1];
    62           }
    63           ok(result[0], msg);
    65           SimpleTest.finish();
    66         });
    67       }, false);
    68       synthesizeKey("VK_LEFT", {});
    69     });
    70   });
    71 });
    73 }
    74 else {
    75   ok(true, "Somebody thought it was a great idea to make me type this.");
    76 }
    78 </script>
    79 </pre>
    80 </body>
    81 </html>

mercurial