React Testing Library · Matcher
toHaveTextContent
toHaveTextContent checks that a selected React DOM element contains expected text. It is a custom matcher from @testing-library/jest-dom.
Last updated
Syntax
expect(element).toHaveTextContent(expectedText)In-depth API docs are only for subscribers: parameters, examples, common mistakes and interview practice.
SubscribeRelated
screengetByRolefindByRole@testing-library/jest-domtoBeDisabled