【发布时间】:2018-01-02 11:13:04
【问题描述】:
我构造了包装器:
this.wrapper = mount(<App />, { context: this.store });
然后我尝试通过它的 id 找到某个 HTML 元素:
console.log("WRAPPER:", this.wrapper.debug());
return this.wrapper.find('#Form-input[0]-fields-field1');
包装器无法找到该元素。 console.log 的输出如下:
WRAPPER:
<Many children/components down...>
<input name="Form-input[0].fields.field1" onBlur={[Function]} onChange={[Function]} onDragStart={[Function]} onDrop={[Function]} onFocus={[Function]} value="asdf" type="text" id="Form-input[0]-fields-field1" disabled={false} />
<Many more things after this...>
因此,具有正确 id 的输入肯定存在。我错过了什么吗?
【问题讨论】:
标签: javascript reactjs redux react-redux enzyme