From ff3b7c26fcb2f94cfa0eadfb8b6a89cc085f4ea1 Mon Sep 17 00:00:00 2001 From: LuckyFBB <976060700@qq.com> Date: Wed, 19 Nov 2025 09:59:52 +0800 Subject: [PATCH] fix(modal): add loading default value fix #627 --- .../__snapshots__/modal.test.tsx.snap | 78 +------------------ src/modal/__tests__/modal.test.tsx | 20 +++++ src/modal/modal.tsx | 2 +- 3 files changed, 24 insertions(+), 76 deletions(-) diff --git a/src/modal/__tests__/__snapshots__/modal.test.tsx.snap b/src/modal/__tests__/__snapshots__/modal.test.tsx.snap index 30ffb72b0..a2a834327 100644 --- a/src/modal/__tests__/__snapshots__/modal.test.tsx.snap +++ b/src/modal/__tests__/__snapshots__/modal.test.tsx.snap @@ -77,32 +77,8 @@ exports[`Test Modal Component Should Match snapshot 1`] = `
-
-
- - - - - - -
-
test @@ -224,32 +200,8 @@ exports[`Test Modal Component Should support banner Should match snapshot for dr
-
-
- - - - - - -
-
test
@@ -366,32 +318,8 @@ exports[`Test Modal Component Should support banner Should match snapshot for re
-
-
- - - - - - -
-
test
diff --git a/src/modal/__tests__/modal.test.tsx b/src/modal/__tests__/modal.test.tsx index 135d9ee0a..6b44c52eb 100644 --- a/src/modal/__tests__/modal.test.tsx +++ b/src/modal/__tests__/modal.test.tsx @@ -162,6 +162,26 @@ describe('Test Modal Component', () => { expect(asFragment()).toMatchSnapshot(); }); + it('Should render Spin correct', () => { + const { container } = render( + + test + + ); + const spin = modal.query(container)!.querySelector('.ant-spin-blur')!; + expect(spin).toBeTruthy(); + }); + + it('Should render no Spin correct', () => { + const { container } = render( + + test + + ); + const spin = modal.query(container)!.querySelector('.ant-spin-blur')!; + expect(spin).toBeFalsy(); + }); + it('Should call onRectChange for resizable modal', () => { const onRectChange = jest.fn(); const { container } = render( diff --git a/src/modal/modal.tsx b/src/modal/modal.tsx index b93e5c884..2fe8c3b86 100644 --- a/src/modal/modal.tsx +++ b/src/modal/modal.tsx @@ -42,7 +42,7 @@ export default function InternalModal({ position, resizable = false, rect, - loading, + loading = false, onRectChange, onPositionChange, modalRender,