| 1282 | testCM("extraKeys", function(cm) { |
| 1283 | var outcome; |
| 1284 | function fakeKey(expected, code, props) { |
| 1285 | if (typeof code == "string") code = code.charCodeAt(0); |
| 1286 | var e = {type: "keydown", keyCode: code, preventDefault: function(){}, stopPropagation: function(){}}; |
| 1287 | if (props) for (var n in props) e[n] = props[n]; |
| 1288 | outcome = null; |
| 1289 | cm.triggerOnKeyDown(e); |
| 1290 | eq(outcome, expected); |
| 1291 | } |
| 1292 | CodeMirror.commands.testCommand = function() {outcome = "tc";}; |
| 1293 | CodeMirror.commands.goTestCommand = function() {outcome = "gtc";}; |
| 1294 | cm.setOption("extraKeys", {"Shift-X": function() {outcome = "sx";}, |