Reputation: 1160
In my application I have an <input>
field on which I want to trigger keydown events.
How can I do this?
Upvotes: 3
Views: 2193
Reputation: 1160
Found a solution. I created a function that can be called passing the key code as parameter:
function keyDown(key: number) {
fixture.debugElement.query(By.css('input')).triggerEventHandler('keydown', { key: key });
}
Upvotes: 5