You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I'm also trying to test a keyboard event. Here is the text of my test:
it('triggers change in environment with arrow keys', () => {
wrapper.find('t').simulate('keydown', { keyCode: 39 });
expect(defaultProps.setServerTypeHandler).toHaveBeenCalledWith('transient');
});
In this case, the function that contains the call to setServerTypeHandler, which is the function that gets called on the keyboard event, is not getting called in the test - I have checked this in the test coverage, and neither the onKeyEvent nor the function, handleKeyPress, are covered. Is there a reason for this?
Thanks for the super-handy component!
It took me a while to figure out how to test keyboard events when using jsdom. Maybe you'd want to add a section on testing to the README?
FYI see jsdom/jsdom#1634 (comment).
The text was updated successfully, but these errors were encountered: