|
1 <?xml version="1.0"?> |
|
2 <?xml-stylesheet href="chrome://global/skin" |
|
3 type="text/css"?> |
|
4 <?xml-stylesheet href="chrome://mochikit/content/tests/SimpleTest/test.css" |
|
5 type="text/css"?> |
|
6 <!-- |
|
7 https://bugzilla.mozilla.org/show_bug.cgi?id=646194 |
|
8 --> |
|
9 <window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" |
|
10 title="Mozilla Bug 646194" onload="runTest();"> |
|
11 <script type="application/javascript" |
|
12 src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"/> |
|
13 |
|
14 <body xmlns="http://www.w3.org/1999/xhtml"> |
|
15 <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=646194" |
|
16 target="_blank">Mozilla Bug 646194</a> |
|
17 <p/> |
|
18 <iframe id="i" src="data:text/html,<div contenteditable=true id=t>test me now</div>"/> |
|
19 <p/> |
|
20 <pre id="test"> |
|
21 </pre> |
|
22 </body> |
|
23 <script class="testbody" type="application/javascript"> |
|
24 <![CDATA[ |
|
25 |
|
26 SimpleTest.expectAssertions(1); |
|
27 |
|
28 function runTest() { |
|
29 function doCommand(aCmd) { |
|
30 var controller = top.document.commandDispatcher |
|
31 .getControllerForCommand(aCmd); |
|
32 ok((controller && controller.isCommandEnabled(aCmd)), "command available"); |
|
33 controller.doCommand(aCmd); |
|
34 } |
|
35 |
|
36 var i = document.getElementById("i"); |
|
37 i.focus(); |
|
38 var win = i.contentWindow; |
|
39 var doc = i.contentDocument; |
|
40 var t = doc.getElementById("t"); |
|
41 t.focus(); |
|
42 // put the caret at the end |
|
43 win.getSelection().collapse(t.firstChild, 11); |
|
44 |
|
45 // Simulate pression Option+Delete on Mac |
|
46 // We do things this way because not every platform can invoke this |
|
47 // command using the available key bindings. |
|
48 doCommand("cmd_wordPrevious"); |
|
49 doCommand("cmd_wordPrevious"); |
|
50 doCommand("cmd_deleteWordBackward"); |
|
51 doCommand("cmd_deleteWordBackward"); |
|
52 |
|
53 // If we reach here, we haven't crashed. Phew! |
|
54 // But let's check the value too, now that we're here. |
|
55 is(t.textContent, "me now", "The command has worked correctly"); |
|
56 |
|
57 SimpleTest.finish(); |
|
58 } |
|
59 |
|
60 SimpleTest.waitForExplicitFinish(); |
|
61 ]]> |
|
62 </script> |
|
63 </window> |