1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_bug_704295.js Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,42 @@ 1.4 +/* vim:set ts=2 sw=2 sts=2 et: */ 1.5 +/* This Source Code Form is subject to the terms of the Mozilla Public 1.6 + * License, v. 2.0. If a copy of the MPL was not distributed with this 1.7 + * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 1.8 + 1.9 +// Tests for bug 704295 1.10 + 1.11 +const TEST_URI = "http://example.com/browser/browser/devtools/webconsole/test/test-console.html"; 1.12 + 1.13 +function test() { 1.14 + addTab(TEST_URI); 1.15 + browser.addEventListener("load", function onLoad() { 1.16 + browser.removeEventListener("load", onLoad, true); 1.17 + openConsole(null, testCompletion); 1.18 + }, true); 1.19 +} 1.20 + 1.21 +function testCompletion(hud) { 1.22 + var jsterm = hud.jsterm; 1.23 + var input = jsterm.inputNode; 1.24 + 1.25 + // Test typing 'var d = 5;' and press RETURN 1.26 + jsterm.setInputValue("var d = "); 1.27 + EventUtils.synthesizeKey("5", {}); 1.28 + EventUtils.synthesizeKey(";", {}); 1.29 + is(input.value, "var d = 5;", "var d = 5;"); 1.30 + is(jsterm.completeNode.value, "", "no completion"); 1.31 + EventUtils.synthesizeKey("VK_RETURN", {}); 1.32 + is(jsterm.completeNode.value, "", "clear completion on execute()"); 1.33 + 1.34 + // Test typing 'var a = d' and press RETURN 1.35 + jsterm.setInputValue("var a = "); 1.36 + EventUtils.synthesizeKey("d", {}); 1.37 + is(input.value, "var a = d", "var a = d"); 1.38 + is(jsterm.completeNode.value, "", "no completion"); 1.39 + EventUtils.synthesizeKey("VK_RETURN", {}); 1.40 + is(jsterm.completeNode.value, "", "clear completion on execute()"); 1.41 + 1.42 + jsterm = input = null; 1.43 + finishTest(); 1.44 +} 1.45 +