How do you simulate an keyDown enter event (or others) in Enzyme?

后端 未结 8 776
臣服心动
臣服心动 2021-02-02 06:08

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 ar

相关标签:
8条回答
  • 2021-02-02 06:37

    This solution is working perfectly:

    wrapper.find('#id1').simulate('keyDown', {key: 'ArrowRight'});
    wrapper.find('#id2').simulate('keyDown', {key: 'Enter'})
    
    0 讨论(0)
  • 2021-02-02 06:38
    wrapper.find('input').simulate('keydown');
    

    It worked for me...

    0 讨论(0)
提交回复
热议问题