test_bug1140617.html (1251B)
1 <!doctype html> 2 <title>Mozilla Bug 1140617</title> 3 <link rel=stylesheet href="/tests/SimpleTest/test.css"> 4 <script src="/tests/SimpleTest/SimpleTest.js"></script> 5 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=1140617" 6 target="_blank">Mozilla Bug 1140617</a> 7 <iframe id="i1" width="200" height="100" src="about:blank"></iframe> 8 <img id="i" src="green.png"> 9 <script> 10 function runTest() { 11 SpecialPowers.setCommandNode(window, document.getElementById("i")); 12 SpecialPowers.doCommand(window, "cmd_copyImageContents"); 13 14 var e = document.getElementById("i1"); 15 var doc = e.contentDocument; 16 doc.designMode = "on"; 17 doc.defaultView.focus(); 18 var selection = doc.defaultView.getSelection(); 19 selection.removeAllRanges(); 20 selection.selectAllChildren(doc.body); 21 selection.collapseToEnd(); 22 23 doc.execCommand("fontname", false, "Arial"); 24 doc.execCommand("bold", false, null); 25 doc.execCommand("insertText", false, "12345"); 26 doc.execCommand("paste", false, null); 27 doc.execCommand("insertText", false, "a"); 28 29 is(doc.queryCommandValue("fontname"), "Arial", "Arial expected"); 30 is(doc.queryCommandState("bold"), true, "Bold expected"); 31 32 SimpleTest.finish(); 33 } 34 35 SimpleTest.waitForExplicitFinish(); 36 addLoadEvent(runTest); 37 </script>