editor/libeditor/text/tests/test_bug636465.xul

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/editor/libeditor/text/tests/test_bug636465.xul	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,61 @@
     1.4 +<?xml version="1.0"?>
     1.5 +<?xml-stylesheet href="chrome://global/skin"
     1.6 +                 type="text/css"?>
     1.7 +<?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css"
     1.8 +                 type="text/css"?>
     1.9 +<!--
    1.10 +https://bugzilla.mozilla.org/show_bug.cgi?id=636465
    1.11 +-->
    1.12 +<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
    1.13 +        title="Mozilla Bug 636465" onload="runTest();">
    1.14 +  <script type="application/javascript"
    1.15 +          src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"/>
    1.16 +  <script type="application/javascript"
    1.17 +          src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/>
    1.18 +  <script type="application/javascript"
    1.19 +          src="chrome://mochikit/content/tests/SimpleTest/WindowSnapshot.js"/>
    1.20 +
    1.21 +  <body xmlns="http://www.w3.org/1999/xhtml">
    1.22 +  <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=636465"
    1.23 +     target="_blank">Mozilla Bug 636465</a>
    1.24 +  <p/>
    1.25 +  <p/>
    1.26 +  <pre id="test">
    1.27 +  </pre>
    1.28 +  </body>
    1.29 +  <textbox id="x" value="foobarbaz" spellcheck="true"/>
    1.30 +  <script class="testbody" type="application/javascript">
    1.31 +  <![CDATA[
    1.32 +
    1.33 +  SimpleTest.waitForExplicitFinish();
    1.34 +
    1.35 +  function runTest() {
    1.36 +    Components.utils.import("resource://gre/modules/AsyncSpellCheckTestHelper.jsm");
    1.37 +    var x = document.getElementById("x");
    1.38 +    x.focus();
    1.39 +    onSpellCheck(x, function () {
    1.40 +      x.blur();
    1.41 +      var spellCheckTrue = snapshotWindow(window);
    1.42 +      x.setAttribute("spellcheck", "false");
    1.43 +      var spellCheckFalse = snapshotWindow(window);
    1.44 +      x.setAttribute("spellcheck", "true");
    1.45 +      x.focus();
    1.46 +      onSpellCheck(x, function () {
    1.47 +        x.blur();
    1.48 +        var spellCheckTrueAgain = snapshotWindow(window);
    1.49 +        x.removeAttribute("spellcheck");
    1.50 +        var spellCheckNone = snapshotWindow(window);
    1.51 +        var after = snapshotWindow(window);
    1.52 +        ok(compareSnapshots(spellCheckTrue, spellCheckFalse, false)[0],
    1.53 +           "Setting the spellcheck attribute to false should work");
    1.54 +        ok(compareSnapshots(spellCheckTrue, spellCheckTrueAgain, true)[0],
    1.55 +           "Setting the spellcheck attribute back to true should work");
    1.56 +        ok(compareSnapshots(spellCheckNone, spellCheckFalse, true)[0],
    1.57 +           "Unsetting the spellcheck attribute should work");
    1.58 +        SimpleTest.finish();
    1.59 +      });
    1.60 +    });
    1.61 +  }
    1.62 +]]>
    1.63 +</script>
    1.64 +</window>

mercurial