Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/reactjs/25.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 属性测试现在返回酶3中的2个元素_Reactjs_Enzyme - Fatal编程技术网

Reactjs 属性测试现在返回酶3中的2个元素

Reactjs 属性测试现在返回酶3中的2个元素,reactjs,enzyme,Reactjs,Enzyme,我刚刚从酶2升级到3,下面的测试以前返回1个元素,现在返回2个: it('should find element', () => { const wrapper = mount(<MyComponent/>); expect(wrapper.find('[name="element"]')).toHaveLength(1); }); it('should find element',()=>{ const wrapper=mount(); expec

我刚刚从酶2升级到3,下面的测试以前返回1个元素,现在返回2个:

  it('should find element', () => {
    const wrapper = mount(<MyComponent/>);

    expect(wrapper.find('[name="element"]')).toHaveLength(1);
  });
it('should find element',()=>{
const wrapper=mount();
expect(wrapper.find('[name=“element”]').toHaveLength(1);
});
我找到的链接似乎表明这是预期的行为

它没有说明为什么这是好的,或者我现在应该如何编写测试