editor/libeditor/html/tests/test_bug629845.html

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/html/tests/test_bug629845.html	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,60 @@
     1.4 +<!DOCTYPE HTML>
     1.5 +<html>
     1.6 +<!--
     1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=629845
     1.8 +-->
     1.9 +<head>
    1.10 +  <title>Test for Bug 629845</title>
    1.11 +  <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script>
    1.12 +  <script type="application/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=629845">Mozilla Bug 629845</a>
    1.17 +<p id="display"></p>
    1.18 +
    1.19 +<script>
    1.20 +function initFrame(frame)
    1.21 +{
    1.22 +  frame.contentWindow.document.designMode="on";
    1.23 +  frame.contentWindow.document.writeln("<body></body>");
    1.24 +
    1.25 +  document.getElementsByTagName('button')[0].click();
    1.26 +}
    1.27 +
    1.28 +function command(aName)
    1.29 +{
    1.30 +  var frame = document.getElementsByTagName('iframe')[0];
    1.31 +
    1.32 +  is(frame.contentDocument.designMode, "on", "design mode should be on!");
    1.33 +  var caught = false;
    1.34 +  try {
    1.35 +    frame.contentDocument.execCommand(aName, false, null);
    1.36 +  } catch (e) {
    1.37 +    ok(false, "exception " + e + " was thrown");
    1.38 +    caught = true;
    1.39 +  }
    1.40 +
    1.41 +  ok(!caught, "No exception should have been thrown.");
    1.42 +
    1.43 +  // Stop the document load before finishing, just to be clean.
    1.44 +  document.getElementsByTagName('iframe')[0].contentWindow.document.close();
    1.45 +  SimpleTest.finish();
    1.46 +}
    1.47 +</script>
    1.48 +
    1.49 +<div id="content">
    1.50 +  <button type="button" onclick="command('bold');">Bold</button>
    1.51 +  <iframe onload="initFrame(this);"></iframe>
    1.52 +</div>
    1.53 +<pre id="test">
    1.54 +<script type="application/javascript">
    1.55 +
    1.56 +/** Test for Bug 629845 **/
    1.57 +
    1.58 +SimpleTest.waitForExplicitFinish();
    1.59 +
    1.60 +</script>
    1.61 +</pre>
    1.62 +</body>
    1.63 +</html>

mercurial