| 173 | * Dispatches a keydown event. Errors if the event was not dispatched successfully. |
| 174 | */ |
| 175 | export function dispatchKeyDownEvent<T extends Element>(element: T, options: KeyboardEventInit = {}) { |
| 176 | const clickEvent = new KeyboardEvent('keydown', options); |
| 177 | const success = element.dispatchEvent(clickEvent); |
| 178 | assert.isOk(success, 'Failed to trigger keydown event successfully.'); |
| 179 | } |
| 180 | |
| 181 | export function dispatchInputEvent<T extends Element>(element: T, options: InputEventInit = {}) { |
| 182 | const inputEvent = new InputEvent('input', options); |