enzyme find selector

Solutions on MaxInterview for enzyme find selector by the best coders in the world

showing results for - "enzyme find selector"
Federico
08 Mar 2019
1const wrapper = shallow(<MyComponent />);
2expect(wrapper.find('.foo')).to.have.lengthOf(1);
3expect(wrapper.find('.bar')).to.have.lengthOf(3);
4
5// compound selector
6expect(wrapper.find('div.some-class')).to.have.lengthOf(3);
7
8// CSS id selector
9expect(wrapper.find('#foo')).to.have.lengthOf(1);
10