fix: ConfirmDialog passing wrong footer prop (#41173)

* fix: ConfirmDialog passing wrong footer prop

* test: add case

* fix: fix modal accidental rendering of footer

* test: update snapshot

* Revert "style(InputNumber): Fixed font highlighting when disabled (#41167)"

This reverts commit 38b47f68f9.

* test: update snapshot

* Align components/input-number/style/index.ts with master

---------

Co-authored-by: Karlo Sudec <karlo.sudec@brainit.agency>
Co-authored-by: wuxh <wxh1220@gmail.com>
This commit is contained in:
Karlo Sudec 2023-03-11 11:35:23 +01:00 committed by GitHub
parent 38b47f68f9
commit 828305bea3
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 72 additions and 1 deletions

View File

@ -185,7 +185,7 @@ const ConfirmDialog: React.FC<ConfirmDialogProps> = (props) => {
onCancel={() => close?.({ triggerCancel: true })}
open={open}
title=""
footer=""
footer={null}
transitionName={getTransitionName(rootPrefixCls, 'zoom', props.transitionName)}
maskTransitionName={getTransitionName(rootPrefixCls, 'fade', props.maskTransitionName)}
mask={mask}

View File

@ -0,0 +1,45 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`Modal.confirm triggers callbacks correctly footer confirm should render the footer when footer is set 1`] = `
<div
class="ant-modal-content"
>
<div
class="ant-modal-body"
>
<div
class="ant-modal-confirm-body-wrapper"
>
<div
class="ant-modal-confirm-body"
>
<span
aria-label="exclamation-circle"
class="bamboo bamboo-exclamation-circle"
role="img"
>
<svg
aria-hidden="true"
data-icon="exclamation-circle"
fill="currentColor"
focusable="false"
height="1em"
viewBox="64 64 896 896"
width="1em"
>
<path
d="M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm-32 232c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V296zm32 440a48.01 48.01 0 010-96 48.01 48.01 0 010 96z"
/>
</svg>
</span>
<div
class="ant-modal-confirm-content"
>
hai
</div>
</div>
hai
</div>
</div>
</div>
`;

View File

@ -803,4 +803,30 @@ describe('Modal.confirm triggers callbacks correctly', () => {
await waitFakeTimer();
expect($$('.custom-modal-footer')).toHaveLength(1);
});
// https://github.com/ant-design/ant-design/issues/41170
describe('footer', () => {
(['confirm', 'info', 'success', 'warning', 'error'] as const).forEach((type) => {
it(`${type} should not render the footer in the default`, async () => {
Modal[type]({
content: 'hai',
});
await waitFakeTimer();
expect(document.querySelector(`.ant-modal-footer`)).toBeFalsy();
});
});
it('confirm should render the footer when footer is set', async () => {
Modal.confirm({
content: 'hai',
footer: 'hai',
});
await waitFakeTimer();
expect(document.querySelector(`.ant-modal-content`)).toMatchSnapshot();
});
});
});