browser/devtools/webconsole/test/browser_webconsole_bug_704295.js

Wed, 31 Dec 2014 06:09:35 +0100

author
Michael Schloh von Bennewitz <michael@schloh.com>
date
Wed, 31 Dec 2014 06:09:35 +0100
changeset 0
6474c204b198
permissions
-rw-r--r--

Cloned upstream origin tor-browser at tor-browser-31.3.0esr-4.5-1-build1
revision ID fc1c9ff7c1b2defdbc039f12214767608f46423f for hacking purpose.

     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 }

mercurial