editor/libeditor/text/tests/test_bug625452.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=625452
     5 -->
     6 <head>
     7   <title>Test for Bug 625452</title>
     8   <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
     9   <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    10   <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
    11 </head>
    12 <body>
    13 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=625452">Mozilla Bug 625452</a>
    14 <p id="display"></p>
    15 <div id="content">
    16 <input>
    17 </div>
    18 <pre id="test">
    19 <script type="application/javascript">
    21 /** Test for Bug 625452 **/
    22 SimpleTest.waitForExplicitFinish();
    23 addLoadEvent(function() {
    24   var i = document.querySelector("input");
    25   var inputCount = 0;
    26   i.addEventListener("input", function() inputCount++, false);
    28   // test cut
    29   i.focus();
    30   i.value = "foo bar";
    31   i.selectionStart = 0;
    32   i.selectionEnd = 4;
    33   synthesizeKey("X", {accelKey: true});
    34   is(i.value, "bar", "Cut should work correctly");
    35   is(inputCount, 1, "input event should be raised correctly");
    37   // test undo
    38   synthesizeKey("Z", {accelKey: true});
    39   is(i.value, "foo bar", "Undo should work correctly");
    40   is(inputCount, 2, "input event should be raised correctly");
    42   // test redo
    43   synthesizeKey("Z", {accelKey: true, shiftKey: true});
    44   is(i.value, "bar", "Redo should work correctly");
    45   is(inputCount, 3, "input event should be raised correctly");
    47   // test delete
    48   i.selectionStart = 0;
    49   i.selectionEnd = 2;
    50   synthesizeKey("VK_DELETE", {});
    51   is(i.value, "r", "Delete should work correctly");
    52   is(inputCount, 4, "input event should be raised correctly");
    54   // test DeleteSelection(eNone)
    55   i.value = "retest"; // the "r" common prefix is crucial here
    56   is(inputCount, 4, "input event should not have been raised");
    58   // paste is tested in test_bug596001.html
    60   SimpleTest.finish();
    61 });
    63 </script>
    64 </pre>
    65 </body>
    66 </html>

mercurial