diff --git a/packages/core/src/components/Modal/Modal/Modal.tsx b/packages/core/src/components/Modal/Modal/Modal.tsx index 31e1b23d2c..0fdddee9c6 100644 --- a/packages/core/src/components/Modal/Modal/Modal.tsx +++ b/packages/core/src/components/Modal/Modal/Modal.tsx @@ -115,14 +115,13 @@ const Modal = forwardRef( style={zIndexStyle} /> - + { expect(getByText("My content")).toBeInTheDocument(); }); + it("ensures the ref prop does not return null when modal is shown", () => { + const ref = React.createRef(); + + const { getByTestId } = render( + +
Content
+
+ ); + + expect(getByTestId("modal")).toBeInTheDocument(); + expect(ref.current).not.toBeNull(); + }); + it("applies default size as 'medium' when not supplied with a size", () => { const { getByRole } = render(