browser/devtools/webconsole/test/browser_webconsole_chrome.js

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/browser/devtools/webconsole/test/browser_webconsole_chrome.js	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,36 @@
     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 that code completion works properly in chrome tabs, like about:credits.
    1.10 +
    1.11 +function test() {
    1.12 +  Task.spawn(function*() {
    1.13 +    const {tab} = yield loadTab("about:config");
    1.14 +    ok(tab, "tab loaded");
    1.15 +
    1.16 +    const hud = yield openConsole(tab);
    1.17 +    ok(hud, "we have a console");
    1.18 +    ok(hud.iframeWindow, "we have the console UI window");
    1.19 +
    1.20 +    let jsterm = hud.jsterm;
    1.21 +    ok(jsterm, "we have a jsterm");
    1.22 +
    1.23 +    let input = jsterm.inputNode;
    1.24 +    ok(hud.outputNode, "we have an output node");
    1.25 +
    1.26 +    // Test typing 'docu'.
    1.27 +    input.value = "docu";
    1.28 +    input.setSelectionRange(4, 4);
    1.29 +
    1.30 +    let deferred = promise.defer();
    1.31 +
    1.32 +    jsterm.complete(jsterm.COMPLETE_HINT_ONLY, function() {
    1.33 +      is(jsterm.completeNode.value, "    ment", "'docu' completion");
    1.34 +      deferred.resolve(null);
    1.35 +    });
    1.36 +
    1.37 +    yield deferred.promise;
    1.38 +  }).then(finishTest);
    1.39 +}

mercurial