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