|
1 <!DOCTYPE HTML> |
|
2 <html> |
|
3 <head> |
|
4 <title>autocomplete with composition tests on HTML input element</title> |
|
5 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> |
|
6 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> |
|
7 <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script> |
|
8 <script type="text/javascript" src="file_autocomplete_with_composition.js"></script> |
|
9 <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> |
|
10 </head> |
|
11 <body> |
|
12 <p id="display"></p> |
|
13 |
|
14 <div id="content"> |
|
15 <iframe id="formTarget" name="formTarget"></iframe> |
|
16 <form action="data:text/html," target="formTarget"> |
|
17 <input name="test" id="input"><input type="submit"> |
|
18 </form> |
|
19 </div> |
|
20 |
|
21 <pre id="test"> |
|
22 <script class="testbody" type="text/javascript"> |
|
23 |
|
24 SimpleTest.waitForExplicitFinish(); |
|
25 |
|
26 function runTests() |
|
27 { |
|
28 var formFillController = |
|
29 SpecialPowers.getFormFillController() |
|
30 .QueryInterface(Components.interfaces.nsIAutoCompleteInput); |
|
31 var originalFormFillTimeout = formFillController.timeout; |
|
32 |
|
33 SpecialPowers.attachFormFillControllerTo(window); |
|
34 var target = document.getElementById("input"); |
|
35 |
|
36 // Register a word to the form history. |
|
37 target.focus(); |
|
38 target.value = "Mozilla"; |
|
39 synthesizeKey("VK_RETURN", {}); |
|
40 target.value = ""; |
|
41 |
|
42 var test1 = new nsDoTestsForAutoCompleteWithComposition( |
|
43 "Testing on HTML input (asynchronously search)", |
|
44 window, target, formFillController.controller, is, |
|
45 function () { return target.value; }, |
|
46 function () { |
|
47 target.setAttribute("timeout", 0); |
|
48 var test2 = new nsDoTestsForAutoCompleteWithComposition( |
|
49 "Testing on HTML input (synchronously search)", |
|
50 window, target, formFillController.controller, is, |
|
51 function () { return target.value; }, |
|
52 function () { |
|
53 formFillController.timeout = originalFormFillTimeout; |
|
54 SpecialPowers.detachFormFillControllerFrom(window); |
|
55 SimpleTest.finish(); |
|
56 }); |
|
57 }); |
|
58 } |
|
59 |
|
60 SimpleTest.waitForFocus(runTests); |
|
61 |
|
62 </script> |
|
63 </pre> |
|
64 </body> |
|
65 </html> |