function createKeyboardEvent(keyCode, opt_type) {
    var ev = document.createEvent('Events');
    ev.initEvent(opt_type || 'keydown', true, true);
    ev.keyCode = keyCode;
    ev.which = keyCode;
    return ev;
  }
Creates a fake KeyboardEvent.

@param {number} keyCode to press
@param {string?} opt_type to use, default keydown
@return {!Event} event