Thu, 22 Jan 2015 13:21:57 +0100
Incorporate requested changes from Mozilla in review:
https://bugzilla.mozilla.org/show_bug.cgi?id=1123480#c6
1 /* vim:set ts=2 sw=2 sts=2 et: */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
6 // Tests for bug 704295
8 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
10 function test() {
11 addTab(TEST_URI);
12 browser.addEventListener("load", function onLoad() {
13 browser.removeEventListener("load", onLoad, true);
14 openConsole(null, testCompletion);
15 }, true);
16 }
18 function testCompletion(hud) {
19 var jsterm = hud.jsterm;
20 var input = jsterm.inputNode;
22 // Test typing 'var d = 5;' and press RETURN
23 jsterm.setInputValue("var d = ");
24 EventUtils.synthesizeKey("5", {});
25 EventUtils.synthesizeKey(";", {});
26 is(input.value, "var d = 5;", "var d = 5;");
27 is(jsterm.completeNode.value, "", "no completion");
28 EventUtils.synthesizeKey("VK_RETURN", {});
29 is(jsterm.completeNode.value, "", "clear completion on execute()");
31 // Test typing 'var a = d' and press RETURN
32 jsterm.setInputValue("var a = ");
33 EventUtils.synthesizeKey("d", {});
34 is(input.value, "var a = d", "var a = d");
35 is(jsterm.completeNode.value, "", "no completion");
36 EventUtils.synthesizeKey("VK_RETURN", {});
37 is(jsterm.completeNode.value, "", "clear completion on execute()");
39 jsterm = input = null;
40 finishTest();
41 }