function getCallback(key, keyCode, type, modifiers) {
      return function () {
        var spy = sinon.spy();
        Mousetrap.bind(key, spy);

        KeyEvent.simulate(key.charCodeAt(0), keyCode, modifiers);
        expect(spy.callCount).to.equal(1);
        expect(spy.args[0][0].type).to.equal(type);
      };
    }
The following strategy of importing modules allows the tests to be run in a browser environment.
Test libraries like `mocha`, `sinon`, etc. are expected to be loaded before this file.