({ videoId = 'igZCEr3HwCg', isGdprCovered = false } = {})
| 16 | const videoUrl = 'https://r.daily.dev/feed-tags'; |
| 17 | |
| 18 | function setup({ videoId = 'igZCEr3HwCg', isGdprCovered = false } = {}) { |
| 19 | const onParentClose = jest.fn(); |
| 20 | const onParentClick = jest.fn(); |
| 21 | const app = document.createElement('div'); |
| 22 | document.body.appendChild(app); |
| 23 | ReactModal.setAppElement(app); |
| 24 | render( |
| 25 | <TestBootProvider client={new QueryClient()} auth={{ isGdprCovered }}> |
| 26 | <Modal isOpen contentLabel="Feed settings" onRequestClose={onParentClose}> |
| 27 | <input aria-label="Search tags" defaultValue="react" /> |
| 28 | <div onClick={onParentClick} role="presentation"> |
| 29 | <TutorialVideoButton |
| 30 | videoId={videoId} |
| 31 | videoUrl={videoUrl} |
| 32 | title={title} |
| 33 | /> |
| 34 | </div> |
| 35 | </Modal> |
| 36 | </TestBootProvider>, |
| 37 | { container: app }, |
| 38 | ); |
| 39 | return { onParentClose, onParentClick }; |
| 40 | } |
| 41 | |
| 42 | it.each(['close button', 'Escape', 'backdrop'])( |
| 43 | 'closes only the tutorial with %s and keeps the parent state and focus', |
no test coverage detected