Bug 1883912: Enable Intl.ListFormat test for "unit" style. r=spidermonkey-reviewers...
[gecko.git] / editor / libeditor / tests / test_bug612447.html
blobfdb3b38f2597e0d3c13f73c9db12932f97374217
1 <!DOCTYPE HTML>
2 <html>
3 <!--
4 https://bugzilla.mozilla.org/show_bug.cgi?id=612447
5 -->
6 <head>
7 <title>Test for Bug 612447</title>
8 <script src="/tests/SimpleTest/SimpleTest.js"></script>
9 <script src="/tests/SimpleTest/EventUtils.js"></script>
10 <script src="/tests/SimpleTest/WindowSnapshot.js"></script>
11 <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/>
12 </head>
13 <body>
14 <a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=612447">Mozilla Bug 612447</a>
15 <p id="display"></p>
16 <div id="content">
17 <iframe></iframe>
18 </div>
19 <pre id="test">
20 <script type="application/javascript">
22 /** Test for Bug 612447 **/
23 SimpleTest.waitForExplicitFinish();
24 SimpleTest.waitForFocus(function() {
25 function editorCommandsEnabled() {
26 var caught = false;
27 try {
28 doc.execCommand("justifyfull", false, null);
29 } catch (e) {
30 caught = true;
32 return !caught;
35 var i = document.querySelector("iframe");
36 var doc = i.contentDocument;
37 var win = i.contentWindow;
38 var b = doc.body;
39 doc.designMode = "on";
40 i.focus();
41 b.focus();
42 var beforeA = snapshotWindow(win, true);
43 sendString("X");
44 var beforeB = snapshotWindow(win, true);
45 is(b.textContent, "X", "Typing should work");
46 while (b.firstChild) {
47 b.firstChild.remove();
49 ok(editorCommandsEnabled(), "The editor commands should work");
51 i.style.display = "block";
52 document.clientWidth;
54 i.focus();
55 b.focus();
56 var afterA = snapshotWindow(win, true);
57 sendString("X");
58 var afterB = snapshotWindow(win, true);
59 is(b.textContent, "X", "Typing should work");
60 while (b.firstChild) {
61 b.firstChild.remove();
63 ok(editorCommandsEnabled(), "The editor commands should work");
65 ok(compareSnapshots(beforeA, afterA, true)[0], "The iframes should look the same before typing");
66 ok(compareSnapshots(beforeB, afterB, true)[0], "The iframes should look the same after typing");
68 SimpleTest.finish();
69 });
71 </script>
72 </pre>
73 </body>
74 </html>