test_bug646194.html (1296B)
1 <!doctype html> 2 <title>Mozilla Bug 646194</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=646194" 6 target="_blank">Mozilla Bug 646194</a> 7 <iframe id="i" srcdoc="<div contenteditable=true id=t>test me now</div>"></iframe> 8 <script> 9 function runTest() { 10 var i = document.getElementById("i"); 11 i.focus(); 12 var win = i.contentWindow; 13 var doc = i.contentDocument; 14 var t = doc.getElementById("t"); 15 t.focus(); 16 // put the caret at the end 17 win.getSelection().collapse(t.firstChild, 11); 18 19 // Simulate pression Option+Delete on Mac 20 // We do things this way because not every platform can invoke this 21 // command using the available key bindings. 22 SpecialPowers.doCommand(window, "cmd_wordPrevious"); 23 SpecialPowers.doCommand(window, "cmd_wordPrevious"); 24 SpecialPowers.doCommand(window, "cmd_deleteWordBackward"); 25 SpecialPowers.doCommand(window, "cmd_deleteWordBackward"); 26 27 // If we reach here, we haven't crashed. Phew! 28 // But let's check the value too, now that we're here. 29 is(t.textContent, "me now", "The command has worked correctly"); 30 31 SimpleTest.finish(); 32 } 33 34 SimpleTest.waitForExplicitFinish(); 35 addLoadEvent(runTest); 36 </script>