diff --git a/components/modal/ConfirmDialog.jsx b/components/modal/ConfirmDialog.jsx index b51efb2b46..6ab9124a3c 100644 --- a/components/modal/ConfirmDialog.jsx +++ b/components/modal/ConfirmDialog.jsx @@ -82,7 +82,9 @@ const ConfirmDialog = (_, { attrs }) => {
{typeof icon === 'function' ? icon() : icon} {attrs.title === undefined ? null : ( - {attrs.title} + + {typeof attrs.title === 'function' ? attrs.title() : attrs.title} + )}
{typeof attrs.content === 'function' ? attrs.content() : attrs.content} diff --git a/components/modal/__tests__/confirm.test.js b/components/modal/__tests__/confirm.test.js index 224fe5f1ef..d5d46ce2a2 100644 --- a/components/modal/__tests__/confirm.test.js +++ b/components/modal/__tests__/confirm.test.js @@ -102,4 +102,12 @@ describe('Modal.confirm triggers callbacks correctly', () => { expect($$(`.ant-modal-confirm-${type}`)).toHaveLength(0); } }); + + it('should render title', async () => { + open({ + title: h => title, + }); + await sleep(); + expect($$('.ant-modal-confirm-title')[0].innerHTML).toBe('title'); + }); });