How To Check An Element Type With Chai?
I want to check whether an element is an a or a div, how do I accomplish this? this code is not working:   it('has no link if required', () => {         const wrapper = shallow(
Solution 1:
Well thats because chais type checking checks for javascript types, not for HTML-Tags.
In case wrapper.find() returns a normal HTML-Element, you could achieve what you want to test with:
expect(wrapper.find('.overlay-asset-link').tagName).to.equal('A'); 
Note: The tagname-property is always uppercase.
Post a Comment for "How To Check An Element Type With Chai?"