From 1b30fa55a9c57ac7dda045471a97d876021cb852 Mon Sep 17 00:00:00 2001 From: Yossi Saadi Date: Wed, 1 Jan 2025 13:03:43 +0200 Subject: [PATCH] fix(Modal): RemoveScroll is overriding Modal's div's ref --- packages/core/src/components/Modal/Modal/Modal.tsx | 3 +-- .../components/Modal/Modal/__tests__/Modal.test.tsx | 13 +++++++++++++ 2 files changed, 14 insertions(+), 2 deletions(-) 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(