酶不为组件选择on Click
我有一个组件标题
组件,该组件采用action
prop,文本
和onclick
事件处理程序。一个示例组件:
<Header id="someId" action={{ text: 'Text', onClick: () => onClickHandler() }}/>
我测试的方式是:
wrapper
.find('#someId')
.first()
.prop('action')
.simulate('click')
我收到一个错误:wrapper.find(...)。第一(...)。prop(...)。仿真不是函数,我可以在哪里出错?
I have a Component Header
component which takes an action
prop which takes text
and onClick
event handler. An example component:
<Header id="someId" action={{ text: 'Text', onClick: () => onClickHandler() }}/>
The way I've tested it is :
wrapper
.find('#someId')
.first()
.prop('action')
.simulate('click')
I get an error : wrapper.find(...).first(...).prop(...).simulate is not a function, where could I be going wrong?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我发现了这一点:我不得不在prop action 上调用
onclick()
I figured it out: I had to call
onClick()
on propaction