1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/toolkit/content/tests/chrome/test_autocomplete_with_composition_on_input.html Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,65 @@ 1.4 +<!DOCTYPE HTML> 1.5 +<html> 1.6 +<head> 1.7 + <title>autocomplete with composition tests on HTML input element</title> 1.8 + <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/SimpleTest.js"></script> 1.9 + <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/EventUtils.js"></script> 1.10 + <script type="text/javascript" src="chrome://mochikit/content/tests/SimpleTest/ChromeUtils.js"></script> 1.11 + <script type="text/javascript" src="file_autocomplete_with_composition.js"></script> 1.12 + <link rel="stylesheet" type="text/css" href="chrome://mochikit/content/tests/SimpleTest/test.css" /> 1.13 +</head> 1.14 +<body> 1.15 +<p id="display"></p> 1.16 + 1.17 +<div id="content"> 1.18 + <iframe id="formTarget" name="formTarget"></iframe> 1.19 + <form action="data:text/html," target="formTarget"> 1.20 + <input name="test" id="input"><input type="submit"> 1.21 + </form> 1.22 +</div> 1.23 + 1.24 +<pre id="test"> 1.25 +<script class="testbody" type="text/javascript"> 1.26 + 1.27 +SimpleTest.waitForExplicitFinish(); 1.28 + 1.29 +function runTests() 1.30 +{ 1.31 + var formFillController = 1.32 + SpecialPowers.getFormFillController() 1.33 + .QueryInterface(Components.interfaces.nsIAutoCompleteInput); 1.34 + var originalFormFillTimeout = formFillController.timeout; 1.35 + 1.36 + SpecialPowers.attachFormFillControllerTo(window); 1.37 + var target = document.getElementById("input"); 1.38 + 1.39 + // Register a word to the form history. 1.40 + target.focus(); 1.41 + target.value = "Mozilla"; 1.42 + synthesizeKey("VK_RETURN", {}); 1.43 + target.value = ""; 1.44 + 1.45 + var test1 = new nsDoTestsForAutoCompleteWithComposition( 1.46 + "Testing on HTML input (asynchronously search)", 1.47 + window, target, formFillController.controller, is, 1.48 + function () { return target.value; }, 1.49 + function () { 1.50 + target.setAttribute("timeout", 0); 1.51 + var test2 = new nsDoTestsForAutoCompleteWithComposition( 1.52 + "Testing on HTML input (synchronously search)", 1.53 + window, target, formFillController.controller, is, 1.54 + function () { return target.value; }, 1.55 + function () { 1.56 + formFillController.timeout = originalFormFillTimeout; 1.57 + SpecialPowers.detachFormFillControllerFrom(window); 1.58 + SimpleTest.finish(); 1.59 + }); 1.60 + }); 1.61 +} 1.62 + 1.63 +SimpleTest.waitForFocus(runTests); 1.64 + 1.65 +</script> 1.66 +</pre> 1.67 +</body> 1.68 +</html>