glenjamin / skin-deep

Test assertion helpers for use with React's shallowRender test utils
MIT License
200 stars 40 forks source link

Class tester should test for whitespace surrounding the className #43

Closed petrometro closed 8 years ago

petrometro commented 8 years ago

Using only word boundaries surrounding the className, we get false positives. Eg. for a node with class 'not-active', findNode('.not-active') returns true but findNode('active') returns true as well.

glenjamin commented 8 years ago

Good catch,

This will need to be "(^|\\s)" + cls + "(\\s|$)" to pass existing tests - and could you add a test case which covers this bug too please?

glenjamin commented 8 years ago

I finished this off and released it as 0.13.1