如何测试oninput事件处理程序

时间:2019-05-05 18:15:28

标签: javascript reactjs

我有一些代码将事件处理程序注册到我的引用中:

componentDidMount() {
   for (const x in this.refs) {
      this.refs[x].oninput = (e) => this.handleInput(e, this.refs[x])
   }
}

但是我无法通过测试触发它们。

我尝试手动触发事件,例如:

rendered.find('.myClass')
  .first()
  .simulate('input', { target: { value: '1' } })

但是这些似乎并没有达到事件处理程序。

0 个答案:

没有答案
相关问题