editor/libeditor/html/tests/test_bug966155.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=966155
     5 -->
     6 <head>
     7   <title>Test for Bug 966155</title>
     8   <script type="text/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=966155">Mozilla Bug 966155</a>
    14 <p id="display"></p>
    15 <div id="content" style="display: none">
    16 </div>
    17 <pre id="test">
    18 <script class="testbody" type="text/javascript">
    19 SimpleTest.waitForExplicitFinish();
    21 addLoadEvent(function() {
    22   var win = window.open("data:text/html,<input><iframe onload=\"contentDocument.designMode = 'on';\">", "", "test-966155");
    23   win.addEventListener("load", function onLoad() {
    24     win.removeEventListener("load", onLoad);
    25     runTest(win);
    26   }, false);
    27 });
    29 function runTest(win) {
    30   SimpleTest.waitForFocus(function() {
    31     var doc = win.document;
    32     var iframe = doc.querySelector("iframe");
    33     var iframeDoc = iframe.contentDocument;
    34     var input = doc.querySelector("input");
    35     iframe.focus();
    36     iframeDoc.body.focus();
    37     // Type some text
    38     "test".split("").forEach(function(letter) {
    39       synthesizeKey(letter, {}, win);
    40     });
    41     is(iframeDoc.body.textContent, "test", "entered the text");
    42     // focus the input box
    43     input.focus();
    44     // press tab
    45     synthesizeKey("VK_TAB", {}, win);
    46     // Now press Ctrl+Backspace
    47     synthesizeKey("VK_BACK_SPACE", {ctrlKey: true}, win);
    48     is(iframeDoc.body.textContent, "", "deleted the text");
    49     win.close();
    50     SimpleTest.finish();
    51   }, win);
    52 }
    54 </script>
    55 </pre>
    56 </body>
    57 </html>

mercurial