This commit is contained in:
Fabian Jakobs 2011-12-14 16:50:04 +01:00
commit 95537b4f4f

View file

@ -56,7 +56,7 @@ module.exports = {
}, },
called: false, called: false,
exec: function(editor) { this.called = true; } exec: function(editor) { this.called = true; }
} };
this.cm = new CommandManager("mac", [this.command]); this.cm = new CommandManager("mac", [this.command]);
}, },
@ -113,7 +113,7 @@ module.exports = {
}, },
called: false, called: false,
exec: function(editor) { this.called = true; } exec: function(editor) { this.called = true; }
} };
this.cm.addCommand(command); this.cm.addCommand(command);
this.cm.exec("gotoline"); this.cm.exec("gotoline");
@ -127,16 +127,16 @@ module.exports = {
var called = ""; var called = "";
this.cm.addCommands({ this.cm.addCommands({
togglerecording: function(editor) { togglerecording: function(editor) {
editor.cm.toggleRecording() editor.cm.toggleRecording();
}, },
replay: function(editor) { replay: function(editor) {
editor.cm.replay() editor.cm.replay();
}, },
cm1: function(editor, arg) { cm1: function(editor, arg) {
called += "1" + (arg || "") called += "1" + (arg || "");
}, },
cm2: function(editor) { cm2: function(editor) {
called += "2" called += "2";
} }
}); });
@ -158,17 +158,17 @@ module.exports = {
var called = ""; var called = "";
this.cm.addCommands({ this.cm.addCommands({
cm1: function(editor, arg) { cm1: function(editor, arg) {
called += "1" + (arg || "") called += "1" + (arg || "");
}, },
cm2: function(editor) { cm2: function(editor) {
called += "2" called += "2";
} }
}); });
this.cm.bindKeys({ this.cm.bindKeys({
"Ctrl-L|Command-C": "cm1", "Ctrl-L|Command-C": "cm1",
"Ctrl-R": "cm2", "Ctrl-R": "cm2"
}) });
var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "C"); var command = this.cm.findKeyCommand(keys.KEY_MODS.command, "C");
assert.equal(command, "cm1"); assert.equal(command, "cm1");
@ -178,7 +178,7 @@ module.exports = {
this.cm.bindKeys({ this.cm.bindKeys({
"Ctrl-R": null "Ctrl-R": null
}) });
var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "R"); var command = this.cm.findKeyCommand(keys.KEY_MODS.ctrl, "R");
assert.equal(command, null); assert.equal(command, null);
@ -188,5 +188,5 @@ module.exports = {
}); });
if (typeof module !== "undefined" && module === require.main) { if (typeof module !== "undefined" && module === require.main) {
require("asyncjs").test.testcase(module.exports).exec() require("asyncjs").test.testcase(module.exports).exec();
} }