diff --git a/README.md b/README.md index 288dac4..933eddb 100644 --- a/README.md +++ b/README.md @@ -303,6 +303,25 @@ function App() { [Read more about plugins here](https://atomiks.github.io/tippyjs/v6/plugins/). +## ๐Ÿงช Testing with `@testing-library/react` + +```jsx +it('shows a tooltip', () => { + render( + + Hover over me! + , + ); + + const referenceElement = screen.getByTestId('referenceElement'); + fireEvent.mouseEnter(referenceElement); + + expect(document.querySelector('.tippy-content')).toHaveTextContent( + 'myTooltip', + ); +}); +``` + ## ๐ŸŒˆ Multiple tippies on a single element You can nest the components like so: