如何在 Enzyme 中生成 blur 或 onBlur 事件?
How do you generate a blur or onBlur event in Enzyme?
我试过:
input.simulate('blur');
和
input.simulate('onBlur');
None 这些作品。这在 Enzyme 中是否可用(我使用的是 2.4.1 版)。
input.simulate('focus')
、input.simulate('change')
和 input.simulate('blur')
应该可以。检查您的 input 是否实际上是声明为 _wrapper.find('input')
的节点并且存在。其次,还有一个类似的问题:
最后,如果你 check the source code of the ReactWrapper component then you will find that it uses all events that React can recognize。所以错误是在你的代码中的某个地方。
我试过:
input.simulate('blur');
和
input.simulate('onBlur');
None 这些作品。这在 Enzyme 中是否可用(我使用的是 2.4.1 版)。
input.simulate('focus')
、input.simulate('change')
和 input.simulate('blur')
应该可以。检查您的 input 是否实际上是声明为 _wrapper.find('input')
的节点并且存在。其次,还有一个类似的问题: