* Helper to create and dispatch a KeyboardEvent
( type: 'keydown' | 'keyup', key: string, code?: string, )
| 6 | * Helper to create and dispatch a KeyboardEvent |
| 7 | */ |
| 8 | function dispatchKey( |
| 9 | type: 'keydown' | 'keyup', |
| 10 | key: string, |
| 11 | code?: string, |
| 12 | ): KeyboardEvent { |
| 13 | const event = new KeyboardEvent(type, { |
| 14 | key, |
| 15 | code: code ?? key, |
| 16 | bubbles: true, |
| 17 | }) |
| 18 | document.dispatchEvent(event) |
| 19 | return event |
| 20 | } |
| 21 | |
| 22 | describe('KeyStateTracker', () => { |
| 23 | beforeEach(() => { |
no outgoing calls
no test coverage detected
searching dependent graphs…