Skip to content

Commit d025227

Browse files
committed
fix: correct markdown formatting in README
1 parent bd2472c commit d025227

File tree

1 file changed

+16
-20
lines changed

1 file changed

+16
-20
lines changed

README.md

Lines changed: 16 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -187,46 +187,42 @@ function HiddenMessage({children}) {
187187
</div>
188188
)
189189
}
190+
191+
export default HiddenMessage
192+
193+
194+
# MORE EXAMPLES
190195
### Testing <details> / <summary>
191196

192197
HTML `<details>` uses `<summary>` as its toggle button.
193-
When testing with React Testing Library, the `<summary>` element is exposed as a
194-
`button` role, so user interactions can be tested normally.
198+
When testing with React Testing Library, the `<summary>` element is exposed as a `button` role.
195199

196200
```js
197-
import { render, screen } from "@testing-library/react"
198-
import userEvent from "@testing-library/user-event"
201+
import { render, screen } from "@testing-library/react";
202+
import userEvent from "@testing-library/user-event";
199203
200204
function DetailsExample() {
201205
return (
202206
<details>
203207
<summary>More info</summary>
204208
<p>Hidden content</p>
205209
</details>
206-
)
210+
);
207211
}
208212
209213
test("opens details when summary is clicked", async () => {
210-
const user = userEvent.setup()
211-
render(<DetailsExample />)
214+
const user = userEvent.setup();
215+
render(<DetailsExample />);
212216
213-
const summary = screen.getByRole("button", { name: /more info/i })
217+
const summary = screen.getByRole("button", { name: /more info/i });
214218
215-
// initially closed
216-
expect(screen.queryByText("Hidden content")).not.toBeInTheDocument()
219+
expect(screen.queryByText("Hidden content")).not.toBeInTheDocument();
217220
218-
await user.click(summary)
221+
await user.click(summary);
219222
220-
// after clicking, content appears
221-
expect(screen.getByText("Hidden content")).toBeInTheDocument()
222-
})
223+
expect(screen.getByText("Hidden content")).toBeInTheDocument();
224+
});
223225
224-
225-
export default HiddenMessage
226-
```
227-
228-
```jsx
229-
// __tests__/hidden-message.js
230226
// these imports are something you'd normally configure Jest to import for you
231227
// automatically. Learn more in the setup docs: https://testing-library.com/docs/react-testing-library/setup#cleanup
232228
import '@testing-library/jest-dom'

0 commit comments

Comments
 (0)