-
Notifications
You must be signed in to change notification settings - Fork 411
Open
Description
Describe the feature you'd like:
It would be nice if toHaveTextContent would allow for exact matches without the need to create a RegExp. (I personally would even prefer if this would be the default behaviour as it is safer.)
RegExp is harder to use when it comes about formatting bigger chunks of text (poor mans snapshot testing), some devs are sadly a bit scared about introducing RegExp and I saw cases like this testing-library/eslint-plugin-jest-dom#337 (comment).
Suggested implementation:
toHaveTextContent('Your text.', { exact: true })(maybe this could even become a default behaviour in a new major version=
Describe alternatives you've considered:
toMatchTextContent('Your text.'): a new matcher
Teachability, Documentation, Adoption, Migration Strategy:
If you make it opt-in it is easy to roll out.
Metadata
Metadata
Assignees
Labels
No labels