editor/libeditor/html/tests/test_bug966155.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/html/tests/test_bug966155.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,57 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=966155
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 966155</title>
    1.11 +  <script type="text/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script>
    1.13 +  <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css" />
    1.14 +</head>
    1.15 +<body>
    1.16 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=966155">Mozilla Bug 966155</a>
    1.17 +<p id="display"></p>
    1.18 +<div id="content" style="display: none">
    1.19 +</div>
    1.20 +<pre id="test">
    1.21 +<script class="testbody" type="text/javascript">
    1.22 +SimpleTest.waitForExplicitFinish();
    1.23 +
    1.24 +addLoadEvent(function() {
    1.25 +  var win = window.open("data:text/html,<input><iframe onload=\"contentDocument.designMode = 'on';\">", "", "test-966155");
    1.26 +  win.addEventListener("load", function onLoad() {
    1.27 +    win.removeEventListener("load", onLoad);
    1.28 +    runTest(win);
    1.29 +  }, false);
    1.30 +});
    1.31 +
    1.32 +function runTest(win) {
    1.33 +  SimpleTest.waitForFocus(function() {
    1.34 +    var doc = win.document;
    1.35 +    var iframe = doc.querySelector("iframe");
    1.36 +    var iframeDoc = iframe.contentDocument;
    1.37 +    var input = doc.querySelector("input");
    1.38 +    iframe.focus();
    1.39 +    iframeDoc.body.focus();
    1.40 +    // Type some text
    1.41 +    "test".split("").forEach(function(letter) {
    1.42 +      synthesizeKey(letter, {}, win);
    1.43 +    });
    1.44 +    is(iframeDoc.body.textContent, "test", "entered the text");
    1.45 +    // focus the input box
    1.46 +    input.focus();
    1.47 +    // press tab
    1.48 +    synthesizeKey("VK_TAB", {}, win);
    1.49 +    // Now press Ctrl+Backspace
    1.50 +    synthesizeKey("VK_BACK_SPACE", {ctrlKey: true}, win);
    1.51 +    is(iframeDoc.body.textContent, "", "deleted the text");
    1.52 +    win.close();
    1.53 +    SimpleTest.finish();
    1.54 +  }, win);
    1.55 +}
    1.56 +
    1.57 +</script>
    1.58 +</pre>
    1.59 +</body>
    1.60 +</html>

mercurial