the-forest/client/node_modules/@testing-library/user-event/dist/keyboard/getEventProps.js
2024-09-17 20:35:18 -04:00

33 lines
908 B
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getKeyEventProps = getKeyEventProps;
exports.getMouseEventProps = getMouseEventProps;
function getKeyEventProps(keyDef, state) {
var _keyDef$keyCode, _keyDef$key;
return {
key: keyDef.key,
code: keyDef.code,
altKey: state.modifiers.alt,
ctrlKey: state.modifiers.ctrl,
metaKey: state.modifiers.meta,
shiftKey: state.modifiers.shift,
/** @deprecated use code instead */
keyCode: (_keyDef$keyCode = keyDef.keyCode) != null ? _keyDef$keyCode : // istanbul ignore next
((_keyDef$key = keyDef.key) == null ? void 0 : _keyDef$key.length) === 1 ? keyDef.key.charCodeAt(0) : undefined
};
}
function getMouseEventProps(state) {
return {
altKey: state.modifiers.alt,
ctrlKey: state.modifiers.ctrl,
metaKey: state.modifiers.meta,
shiftKey: state.modifiers.shift
};
}