Created
February 11, 2021 19:10
-
-
Save matheusml/5e604b3cc8fce1cb2512ae995fc03cfa to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
test('can open accordion items to see the contents', () => { | |
const hats = {title: 'Favorite Hats', contents: 'Fedoras are classy'} | |
const footware = { | |
title: 'Favorite Footware', | |
contents: 'Flipflops are the best', | |
} | |
render(<Accordion items={[hats, footware]} />) | |
expect(screen.getByText(hats.contents)).toBeInTheDocument() | |
expect(screen.queryByText(footware.contents)).not.toBeInTheDocument() | |
userEvent.click(screen.getByText(footware.title)) | |
expect(screen.getByText(footware.contents)).toBeInTheDocument() | |
expect(screen.queryByText(hats.contents)).not.toBeInTheDocument() | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment