MCPcopy Create free account
hub / github.com/OpenEndedGroup/Field2 / fakeKey

Function fakeKey

lib/web/CodeMirror/test/test.js:1284–1291  ·  view source on GitHub ↗
(expected, code, props)

Source from the content-addressed store, hash-verified

1282testCM("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";},

Callers 1

test.jsFile · 0.85

Calls 1

eqFunction · 0.85

Tested by

no test coverage detected