You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I wonder if it would be acceptable to the goals and intentions of this library to provide certain other custom matchers for common tasks. In this particular case I'd be proposing a .toHaveAttribute custom matcher that could work both to assert that an element has an attribute present or not, but also to assert that the attribute is present and has a certain value:
It could be considered syntactic sugar, but I think it makes tests more readable. Although I'd also understand if these are considered out of the scope of this library.
The text was updated successfully, but these errors were encountered:
* Add toHaveAttribute custom matcher
* Add gnapse as contributor
* Generate messages more consistent with jest's other matchers
* Add comment to matcher hint
* Add tests to cover toHaveAttribute custom matcher
julienw
pushed a commit
to julienw/react-testing-library
that referenced
this issue
Dec 20, 2018
I'm finding my self commonly checking if an element has a given attribute or not, and possibly also expecting a certain value off some attribute.
I wonder if it would be acceptable to the goals and intentions of this library to provide certain other custom matchers for common tasks. In this particular case I'd be proposing a
.toHaveAttribute
custom matcher that could work both to assert that an element has an attribute present or not, but also to assert that the attribute is present and has a certain value:It could be considered syntactic sugar, but I think it makes tests more readable. Although I'd also understand if these are considered out of the scope of this library.
The text was updated successfully, but these errors were encountered: