2022-10-03 22:27:34 +00:00
|
|
|
import {
|
|
|
|
isEnter,
|
|
|
|
isEscape,
|
|
|
|
hasPressedShift,
|
|
|
|
hasPressedCommand,
|
|
|
|
buildHotKeys,
|
|
|
|
} from '../KeyboardHelpers';
|
2020-07-16 19:02:32 +00:00
|
|
|
|
|
|
|
describe('#KeyboardHelpers', () => {
|
|
|
|
describe('#isEnter', () => {
|
|
|
|
it('return correct values', () => {
|
|
|
|
expect(isEnter({ keyCode: 13 })).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#isEscape', () => {
|
|
|
|
it('return correct values', () => {
|
|
|
|
expect(isEscape({ keyCode: 27 })).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#hasPressedShift', () => {
|
|
|
|
it('return correct values', () => {
|
|
|
|
expect(hasPressedShift({ shiftKey: true })).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
2022-10-03 22:27:34 +00:00
|
|
|
|
|
|
|
describe('#hasPressedCommand', () => {
|
|
|
|
it('return correct values', () => {
|
|
|
|
expect(hasPressedCommand({ metaKey: true })).toEqual(true);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('#buildHotKeys', () => {
|
|
|
|
it('returns hot keys', () => {
|
|
|
|
expect(buildHotKeys({ altKey: true, key: 'alt' })).toEqual('alt');
|
|
|
|
expect(buildHotKeys({ ctrlKey: true, key: 'a' })).toEqual('ctrl+a');
|
|
|
|
expect(buildHotKeys({ metaKey: true, key: 'b' })).toEqual('meta+b');
|
|
|
|
});
|
|
|
|
});
|
2020-07-16 19:02:32 +00:00
|
|
|
});
|