michael@0: /* vim:set ts=2 sw=2 sts=2 et: */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: // Tests that code completion works properly in chrome tabs, like about:credits. michael@0: michael@0: function test() { michael@0: Task.spawn(function*() { michael@0: const {tab} = yield loadTab("about:config"); michael@0: ok(tab, "tab loaded"); michael@0: michael@0: const hud = yield openConsole(tab); michael@0: ok(hud, "we have a console"); michael@0: ok(hud.iframeWindow, "we have the console UI window"); michael@0: michael@0: let jsterm = hud.jsterm; michael@0: ok(jsterm, "we have a jsterm"); michael@0: michael@0: let input = jsterm.inputNode; michael@0: ok(hud.outputNode, "we have an output node"); michael@0: michael@0: // Test typing 'docu'. michael@0: input.value = "docu"; michael@0: input.setSelectionRange(4, 4); michael@0: michael@0: let deferred = promise.defer(); michael@0: michael@0: jsterm.complete(jsterm.COMPLETE_HINT_ONLY, function() { michael@0: is(jsterm.completeNode.value, " ment", "'docu' completion"); michael@0: deferred.resolve(null); michael@0: }); michael@0: michael@0: yield deferred.promise; michael@0: }).then(finishTest); michael@0: }