Skip to content

Commit ff3b7c2

Browse files
committed
fix(modal): add loading default value
fix #627
1 parent ab9a930 commit ff3b7c2

File tree

3 files changed

+24
-76
lines changed

3 files changed

+24
-76
lines changed

src/modal/__tests__/__snapshots__/modal.test.tsx.snap

Lines changed: 3 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -77,32 +77,8 @@ exports[`Test Modal Component Should Match snapshot 1`] = `
7777
<div
7878
class="ant-spin-nested-loading"
7979
>
80-
<div>
81-
<div
82-
aria-busy="true"
83-
aria-live="polite"
84-
class="ant-spin ant-spin-spinning"
85-
>
86-
<span
87-
class="ant-spin-dot ant-spin-dot-spin"
88-
>
89-
<i
90-
class="ant-spin-dot-item"
91-
/>
92-
<i
93-
class="ant-spin-dot-item"
94-
/>
95-
<i
96-
class="ant-spin-dot-item"
97-
/>
98-
<i
99-
class="ant-spin-dot-item"
100-
/>
101-
</span>
102-
</div>
103-
</div>
10480
<div
105-
class="ant-spin-container ant-spin-blur"
81+
class="ant-spin-container"
10682
>
10783
<div>
10884
test
@@ -224,32 +200,8 @@ exports[`Test Modal Component Should support banner Should match snapshot for dr
224200
<div
225201
class="ant-spin-nested-loading"
226202
>
227-
<div>
228-
<div
229-
aria-busy="true"
230-
aria-live="polite"
231-
class="ant-spin ant-spin-spinning"
232-
>
233-
<span
234-
class="ant-spin-dot ant-spin-dot-spin"
235-
>
236-
<i
237-
class="ant-spin-dot-item"
238-
/>
239-
<i
240-
class="ant-spin-dot-item"
241-
/>
242-
<i
243-
class="ant-spin-dot-item"
244-
/>
245-
<i
246-
class="ant-spin-dot-item"
247-
/>
248-
</span>
249-
</div>
250-
</div>
251203
<div
252-
class="ant-spin-container ant-spin-blur"
204+
class="ant-spin-container"
253205
>
254206
test
255207
</div>
@@ -366,32 +318,8 @@ exports[`Test Modal Component Should support banner Should match snapshot for re
366318
<div
367319
class="ant-spin-nested-loading"
368320
>
369-
<div>
370-
<div
371-
aria-busy="true"
372-
aria-live="polite"
373-
class="ant-spin ant-spin-spinning"
374-
>
375-
<span
376-
class="ant-spin-dot ant-spin-dot-spin"
377-
>
378-
<i
379-
class="ant-spin-dot-item"
380-
/>
381-
<i
382-
class="ant-spin-dot-item"
383-
/>
384-
<i
385-
class="ant-spin-dot-item"
386-
/>
387-
<i
388-
class="ant-spin-dot-item"
389-
/>
390-
</span>
391-
</div>
392-
</div>
393321
<div
394-
class="ant-spin-container ant-spin-blur"
322+
class="ant-spin-container"
395323
>
396324
test
397325
</div>

src/modal/__tests__/modal.test.tsx

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,26 @@ describe('Test Modal Component', () => {
162162
expect(asFragment()).toMatchSnapshot();
163163
});
164164

165+
it('Should render Spin correct', () => {
166+
const { container } = render(
167+
<Modal visible title="title" getContainer={false} loading>
168+
test
169+
</Modal>
170+
);
171+
const spin = modal.query(container)!.querySelector<HTMLDivElement>('.ant-spin-blur')!;
172+
expect(spin).toBeTruthy();
173+
});
174+
175+
it('Should render no Spin correct', () => {
176+
const { container } = render(
177+
<Modal visible title="title" getContainer={false} loading={false}>
178+
test
179+
</Modal>
180+
);
181+
const spin = modal.query(container)!.querySelector<HTMLDivElement>('.ant-spin-blur')!;
182+
expect(spin).toBeFalsy();
183+
});
184+
165185
it('Should call onRectChange for resizable modal', () => {
166186
const onRectChange = jest.fn();
167187
const { container } = render(

src/modal/modal.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ export default function InternalModal({
4242
position,
4343
resizable = false,
4444
rect,
45-
loading,
45+
loading = false,
4646
onRectChange,
4747
onPositionChange,
4848
modalRender,

0 commit comments

Comments
 (0)