xonecas.io
4828
Sr

stream-together / commit dbe7a8c

Adds a test for closed modal

sean2024-06-29 dbe7a8cb6b3491ce1639cd78f8de1d8d5b7fa127 parent 8a65479

1 file changed

__tests__/modal.test.tsx+16−0
@@ -18,4 +18,20 @@ describe("Modal component", () => {
1818 );
1919 expect(modalContent).toBeInTheDocument();
2020 });
21+
22+ it("renders only the button", async () => {
23+ render(
24+ <Modal openButton={<button>open</button>} showModal={false}>
25+ <p>Modal content should be visible</p>
26+ </Modal>,
27+ );
28+
29+ const openButton = await screen.findByText("open");
30+ expect(openButton).toBeInTheDocument();
31+
32+ const modalContent = await screen.queryByText(
33+ "Modal content should be visible",
34+ );
35+ expect(modalContent).toBeNull();
36+ });
2137 });