1 var dactyllib = require("utils").module("dactyl");
3 var setupModule = function (module) {
4 controller = mozmill.getBrowserController();
5 dactyl = new dactyllib.Controller(controller);
8 var teardownModule = function (module) {
12 var teardownTest = function (test) {
13 dactyl.closeMessageWindow();
16 var testEchoCommand_SingleLineMessageAndClosedMOW_MessageDisplayedInMessageLine = function () {
17 const output = "foobar";
19 assertEchoGeneratesLineOutput({
20 ECHO_COMMAND: "echo " + output.quote(),
21 EXPECTED_OUTPUT: output
25 var testEchoCommand_SingleLineMessageAndOpenMOW_MessageAppendedToMOW = function () {
26 const output = "foobar";
28 dactyl.openMessageWindow();
30 assertEchoGeneratesWindowOutput({
31 ECHO_COMMAND: "echo " + output.quote(),
32 EXPECTED_OUTPUT: RegExp(output)
36 var testEchoCommand_MultilineMessageAndClosedMOW_MessageDisplayedInMOW = function () {
37 const output = "foo\nbar";
39 assertEchoGeneratesWindowOutput({
40 ECHO_COMMAND: "echo " + output.quote(),
41 EXPECTED_OUTPUT: output
45 var testEchoCommand_MultilineMessageAndOpenMOW_MessageAppendedToMOW = function () {
46 const output = "foo\nbar";
48 dactyl.openMessageWindow();
50 assertEchoGeneratesWindowOutput({
51 ECHO_COMMAND: "echo " + output.quote(),
52 EXPECTED_OUTPUT: RegExp(output)
56 var testEchoCommand_ObjectArgumentAndClosedMOW_MessageDisplayedInMOW = function () {
57 assertEchoGeneratesWindowOutput({
58 ECHO_COMMAND: "echo var obj = { x: 1, y: 2 }; obj;",
59 EXPECTED_OUTPUT: "[object\u00A0Object]::\nx: 1\ny: 2\n"
63 function executeCommand(command) {
64 dactyl.runViCommand(":" + command);
65 dactyl.runViCommand([["VK_RETURN"]]);
68 function assertEchoGeneratesWindowOutput({ ECHO_COMMAND, EXPECTED_OUTPUT }) {
69 executeCommand(ECHO_COMMAND);
70 dactyl.assertMessageWindow(EXPECTED_OUTPUT);
73 function assertEchoGeneratesLineOutput({ ECHO_COMMAND, EXPECTED_OUTPUT }) {
74 executeCommand(ECHO_COMMAND);
75 dactyl.assertMessageLine(EXPECTED_OUTPUT);