Skip to content

Commit

Permalink
fix(modal): title props support render function (vueComponent#3031)
Browse files Browse the repository at this point in the history
  • Loading branch information
John60676 authored Oct 24, 2020
1 parent 157d0e7 commit 9ac18c5
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
4 changes: 3 additions & 1 deletion components/modal/ConfirmDialog.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,9 @@ const ConfirmDialog = (_, { attrs }) => {
<div class={`${contentPrefixCls}-body`}>
{typeof icon === 'function' ? icon() : icon}
{attrs.title === undefined ? null : (
<span class={`${contentPrefixCls}-title`}>{attrs.title}</span>
<span class={`${contentPrefixCls}-title`}>
{typeof attrs.title === 'function' ? attrs.title() : attrs.title}
</span>
)}
<div class={`${contentPrefixCls}-content`}>
{typeof attrs.content === 'function' ? attrs.content() : attrs.content}
Expand Down
8 changes: 8 additions & 0 deletions components/modal/__tests__/confirm.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 => <span>title</span>,
});
await sleep();
expect($$('.ant-modal-confirm-title')[0].innerHTML).toBe('<span>title</span>');
});
});

0 comments on commit 9ac18c5

Please sign in to comment.