If you want to select element text with react+enzyme? All attributes are camel-cased and the attributes class and for are className and htmlFor, respectively, to match the DOM API specification.
1 2 3 | const wrapper = shallow(<div><button className='btn btn-primary'>OK</button></div>); const button = wrapper.find('.btn'); expect(button.text()).to.be.eql('OK'); |
If you like this question & answer and want to contribute, then write your question & answer and email to freewebmentor[@]gmail.com. Your question and answer will appear on FreeWebMentor.com and help other developers.