fix(modal): title props support render function (#3030)
parent
4a3e310db7
commit
6c521620b6
|
@ -94,7 +94,9 @@ export default {
|
|||
<div class={`${contentPrefixCls}-body`}>
|
||||
{iconNode}
|
||||
{props.title === undefined ? null : (
|
||||
<span class={`${contentPrefixCls}-title`}>{props.title}</span>
|
||||
<span class={`${contentPrefixCls}-title`}>
|
||||
{typeof props.title === 'function' ? props.title(h) : props.title}
|
||||
</span>
|
||||
)}
|
||||
<div class={`${contentPrefixCls}-content`}>
|
||||
{typeof props.content === 'function' ? props.content(h) : props.content}
|
||||
|
|
|
@ -88,7 +88,7 @@ describe('Modal.confirm triggers callbacks correctly', () => {
|
|||
expect($$('.ant-btn')[1].disabled).toBe(true);
|
||||
});
|
||||
|
||||
fit('trigger onCancel once when click on cancel button', async () => {
|
||||
it('trigger onCancel once when click on cancel button', async () => {
|
||||
const arr = ['info', 'success', 'warning', 'error'];
|
||||
for (let type of arr) {
|
||||
Modal[type]({
|
||||
|
@ -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>');
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue