【发布时间】:2016-12-30 14:46:50
【问题描述】:
假设我的 React 组件中有一个方法:
doSomething() {
// method uses this.props and this.state
}
我想针对设置的不同道具和状态测试此方法。那我怎么称呼它? MyClass.prototype.doSomething 将调用该函数,但未设置 this.props 和 this.state。
【问题讨论】:
-
那么当你用酶创建组件时,是什么阻止你只传递道具?
标签: javascript reactjs enzyme