* Helper to create and dispatch a KeyboardEvent
(
key: string,
options: { eventType?: 'keydown' | 'keyup' } = {},
)
| 9 | * Helper to create and dispatch a KeyboardEvent |
| 10 | */ |
| 11 | function dispatchKey( |
| 12 | key: string, |
| 13 | options: { eventType?: 'keydown' | 'keyup' } = {}, |
| 14 | ): KeyboardEvent { |
| 15 | const eventType = options.eventType ?? 'keydown' |
| 16 | const event = new KeyboardEvent(eventType, { key, bubbles: true }) |
| 17 | document.dispatchEvent(event) |
| 18 | return event |
| 19 | } |
| 20 | |
| 21 | /** |
| 22 | * Helper to dispatch a keyboard event from a specific element. |
no outgoing calls
no test coverage detected
searching dependent graphs…