I'm trying to simulate a keyDown
event, specifically for Enter, keyCode: 13
. I've tried a number of different ways of doing this, but none of them are working. I've also looked online and it seems like this feature is either buggy or not working in the current version of Enzyme. Does anyone know definitively if this feature works, and if so, what is the proper syntax for simulating an enter, or other types of key events? Thanks!
This is what I have currently, and it's not working:
const input = wrapper.find('input');
input.simulate('keyDown', {keyCode: 13});
My current Enzyme version is 2.4.1
shallow
ormount
?sinon
andchai
's spy utilities in enzyme, so I haven't been able to use those to verify user events.onChange
event to your input field and console.log every event. Then run your test and see if you get thekeyDown
eventkeydown