2012-05-10 10:33:54 -07:00
|
|
|
/* Any copyright is dedicated to the Public Domain.
|
|
|
|
* http://creativecommons.org/publicdomain/zero/1.0/ */
|
|
|
|
|
|
|
|
// Test various GCLI commands
|
|
|
|
|
|
|
|
const TEST_URI = "data:text/html;charset=utf-8,gcli-commands";
|
|
|
|
|
2013-03-12 21:51:30 -07:00
|
|
|
function test() {
|
2013-09-03 04:20:27 -07:00
|
|
|
return Task.spawn(spawnTest).then(finish, helpers.handleError);
|
2012-05-10 10:33:54 -07:00
|
|
|
}
|
|
|
|
|
2013-09-03 04:20:27 -07:00
|
|
|
function spawnTest() {
|
|
|
|
let options = yield helpers.openTab(TEST_URI);
|
|
|
|
yield helpers.openToolbar(options);
|
|
|
|
|
|
|
|
let subjectPromise = helpers.observeOnce("web-console-created");
|
2012-07-26 08:06:04 -07:00
|
|
|
|
2013-03-12 21:51:30 -07:00
|
|
|
helpers.audit(options, [
|
|
|
|
{
|
|
|
|
setup: "console open",
|
|
|
|
exec: { }
|
|
|
|
}
|
|
|
|
]);
|
2012-07-26 08:06:04 -07:00
|
|
|
|
2013-09-03 04:20:27 -07:00
|
|
|
let subject = yield subjectPromise;
|
|
|
|
|
|
|
|
subject.QueryInterface(Ci.nsISupportsString);
|
|
|
|
let hud = HUDService.getHudReferenceById(subject.data);
|
|
|
|
ok(hud, "console open");
|
|
|
|
|
2014-12-16 17:18:19 -08:00
|
|
|
let msg = yield hud.jsterm.execute("pprint(window)");
|
2013-09-03 04:20:27 -07:00
|
|
|
|
|
|
|
ok(msg, "output for pprint(window)");
|
|
|
|
|
|
|
|
let oncePromise = hud.jsterm.once("messages-cleared");
|
|
|
|
|
|
|
|
helpers.audit(options, [
|
|
|
|
{
|
|
|
|
setup: "console clear",
|
|
|
|
exec: { output: "" }
|
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
yield oncePromise;
|
|
|
|
|
|
|
|
let labels = hud.outputNode.querySelectorAll(".message");
|
|
|
|
is(labels.length, 0, "no output in console");
|
|
|
|
|
|
|
|
yield helpers.audit(options, [
|
|
|
|
{
|
|
|
|
setup: "console close",
|
2014-04-11 14:47:22 -07:00
|
|
|
exec: { output: true }
|
2013-09-03 04:20:27 -07:00
|
|
|
}
|
|
|
|
]);
|
|
|
|
|
|
|
|
ok(!HUDService.getHudReferenceById(hud.hudId), "console closed");
|
|
|
|
|
|
|
|
yield helpers.closeToolbar(options);
|
|
|
|
yield helpers.closeTab(options);
|
|
|
|
}
|