| 1 | import { describe, expect, it } from 'vitest' |
| 2 | import { isPresentShortcut } from './utils' |
| 3 | |
| 4 | describe('isPresentShortcut', () => { |
| 5 | const key = (key: string, mods: { metaKey?: boolean, ctrlKey?: boolean } = {}) => |
| 6 | ({ |
| 7 | key, |
| 8 | metaKey: false, |
| 9 | ctrlKey: false, |
| 10 | ...mods, |
| 11 | }) |
| 12 | |
| 13 | it('matches Google Slides present keys', () => { |
| 14 | expect(isPresentShortcut(key('Enter', { metaKey: true }))).toBe(true) |
| 15 | expect(isPresentShortcut(key('F5', { ctrlKey: true }))).toBe(true) |
| 16 | }) |
| 17 | |
| 18 | it('ignores other keys', () => { |
| 19 | expect(isPresentShortcut(key('Enter'))).toBe(false) |
| 20 | expect(isPresentShortcut(key('Enter', { ctrlKey: true }))).toBe(false) |
| 21 | expect(isPresentShortcut(key('F5'))).toBe(false) |
| 22 | expect(isPresentShortcut(key('F5', { metaKey: true }))).toBe(false) |
| 23 | }) |
| 24 | }) |
| 25 |