Returns whether or not the wrapped node has a className
prop including the passed in class name. It must be a single-node wrapper.
className
(String
): A single class name.
Boolean
: whether or not the wrapped node has the class.
const wrapper = mount(<MyComponent />);
expect(wrapper.find('.my-button').hasClass('disabled')).to.equal(true);
.hasClass()
expects a class name, NOT a CSS selector..hasClass('.foo')
should be.hasClass('foo')