Reactjs 属性测试现在返回酶3中的2个元素
我刚刚从酶2升级到3,下面的测试以前返回1个元素,现在返回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
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);
});
我找到的链接似乎表明这是预期的行为
它没有说明为什么这是好的,或者我现在应该如何编写测试