browser/devtools/webconsole/test/browser_webconsole_bug_704295.js

changeset 0
6474c204b198
equal deleted inserted replaced
-1:000000000000 0:5c79064b2479
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/. */
5
6 // Tests for bug 704295
7
8 const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html";
9
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 }
17
18 function testCompletion(hud) {
19 var jsterm = hud.jsterm;
20 var input = jsterm.inputNode;
21
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()");
30
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()");
38
39 jsterm = input = null;
40 finishTest();
41 }
42

mercurial