I just lost a few minutes because I had:
wrapper = mount(...)
expect(wrapper.hasClass('foo')).toEqual(true)
Where it of course should have been wrapper.find('button').hasClass(...). Would it be possible to catch when someone is calling hasClass on the wrong thing and throw an error? I'm happy to do the PR if you think this is worthwhile. No worries if not!
Potentially even just adding this as a gotcha to the hasClass docs might be enough (which again, I'm happy to do).
I've run into the same problem today and noticed that shallow vs mount behaves differently:
````javascript
wrapper = shallow(
wrapper = mount(
I'm having the same issue as @simonvizzini
hasClass on a mounted wrapper doesn't always work.
Looks like this commit fixes my issue, since I was trying to check a class on a non DOM element, which was impossible with the current code in 2.6.0.
Any way we can get a new release soon @lelandrichardson @ljharb ?
v2.7.0 just published.
@jackfranklin please reopen if that doesn't solve your issue.
Looks perfect, thank you so much 馃憤
Most helpful comment
v2.7.0 just published.
@jackfranklin please reopen if that doesn't solve your issue.