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

后端 未结 8 901
臣服心动
臣服心动 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:14

    const wrapper = mount();
    const input = wrapper.find('input');
    input.props().onKeyDown({key: 'Enter'});
    
    • Enzyme 3.9.0
    • React 16.8.6

提交回复
热议问题