|
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 that code completion works properly in chrome tabs, like about:credits. |
|
7 |
|
8 function test() { |
|
9 Task.spawn(function*() { |
|
10 const {tab} = yield loadTab("about:config"); |
|
11 ok(tab, "tab loaded"); |
|
12 |
|
13 const hud = yield openConsole(tab); |
|
14 ok(hud, "we have a console"); |
|
15 ok(hud.iframeWindow, "we have the console UI window"); |
|
16 |
|
17 let jsterm = hud.jsterm; |
|
18 ok(jsterm, "we have a jsterm"); |
|
19 |
|
20 let input = jsterm.inputNode; |
|
21 ok(hud.outputNode, "we have an output node"); |
|
22 |
|
23 // Test typing 'docu'. |
|
24 input.value = "docu"; |
|
25 input.setSelectionRange(4, 4); |
|
26 |
|
27 let deferred = promise.defer(); |
|
28 |
|
29 jsterm.complete(jsterm.COMPLETE_HINT_ONLY, function() { |
|
30 is(jsterm.completeNode.value, " ment", "'docu' completion"); |
|
31 deferred.resolve(null); |
|
32 }); |
|
33 |
|
34 yield deferred.promise; |
|
35 }).then(finishTest); |
|
36 } |