1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/editor/libeditor/html/tests/test_bug612447.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,74 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<!-- 1.7 +https://bugzilla.mozilla.org/show_bug.cgi?id=612447 1.8 +--> 1.9 +<head> 1.10 + <title>Test for Bug 612447</title> 1.11 + <script type="application/javascript" src="/tests/SimpleTest/SimpleTest.js"></script> 1.12 + <script type="text/javascript" src="/tests/SimpleTest/EventUtils.js"></script> 1.13 + <script type="text/javascript" src="/tests/SimpleTest/WindowSnapshot.js"></script> 1.14 + <link rel="stylesheet" type="text/css" href="/tests/SimpleTest/test.css"/> 1.15 +</head> 1.16 +<body> 1.17 +<a target="_blank" href="https://bugzilla.mozilla.org/show_bug.cgi?id=612447">Mozilla Bug 612447</a> 1.18 +<p id="display"></p> 1.19 +<div id="content"> 1.20 +<iframe></iframe> 1.21 +</div> 1.22 +<pre id="test"> 1.23 +<script type="application/javascript"> 1.24 + 1.25 +/** Test for Bug 612447 **/ 1.26 +SimpleTest.waitForExplicitFinish(); 1.27 +SimpleTest.waitForFocus(function() { 1.28 + function editorCommandsEnabled() { 1.29 + var caught = false; 1.30 + try { 1.31 + doc.execCommand("justifyfull", false, null); 1.32 + } catch (e) { 1.33 + caught = true; 1.34 + } 1.35 + return !caught; 1.36 + } 1.37 + 1.38 + var i = document.querySelector("iframe"); 1.39 + var doc = i.contentDocument; 1.40 + var win = i.contentWindow; 1.41 + var b = doc.body; 1.42 + doc.designMode = "on"; 1.43 + i.focus(); 1.44 + b.focus(); 1.45 + var beforeA = snapshotWindow(win, true); 1.46 + synthesizeKey("X", {}); 1.47 + var beforeB = snapshotWindow(win, true); 1.48 + is(b.textContent, "X", "Typing should work"); 1.49 + while (b.firstChild) { 1.50 + b.removeChild(b.firstChild); 1.51 + } 1.52 + ok(editorCommandsEnabled(), "The editor commands should work"); 1.53 + 1.54 + i.style.display = "block"; 1.55 + document.clientWidth; 1.56 + 1.57 + i.focus(); 1.58 + b.focus(); 1.59 + var afterA = snapshotWindow(win, true); 1.60 + synthesizeKey("X", {}); 1.61 + var afterB = snapshotWindow(win, true); 1.62 + is(b.textContent, "X", "Typing should work"); 1.63 + while (b.firstChild) { 1.64 + b.removeChild(b.firstChild); 1.65 + } 1.66 + ok(editorCommandsEnabled(), "The editor commands should work"); 1.67 + 1.68 + ok(compareSnapshots(beforeA, afterA, true)[0], "The iframes should look the same before typing"); 1.69 + ok(compareSnapshots(beforeB, afterB, true)[0], "The iframes should look the same after typing"); 1.70 + 1.71 + SimpleTest.finish(); 1.72 +}); 1.73 + 1.74 +</script> 1.75 +</pre> 1.76 +</body> 1.77 +</html>