test: update test

pull/2900/head
tangjinzhou 2020-09-20 23:04:37 +08:00
parent f99200c966
commit 7f7511bf61
2 changed files with 14 additions and 13 deletions

View File

@ -66,7 +66,7 @@ describe('notification', () => {
notification.destroy(); notification.destroy();
}); });
it('should be able to open with icon', done => { it('should be able to open with icon', async () => {
const openNotificationWithIcon = async type => { const openNotificationWithIcon = async type => {
const iconPrefix = '.ant-notification-notice-icon'; const iconPrefix = '.ant-notification-notice-icon';
notification[type]({ notification[type]({
@ -78,10 +78,10 @@ describe('notification', () => {
expect(document.querySelectorAll(`${iconPrefix}-${type}`).length).toBe(1); expect(document.querySelectorAll(`${iconPrefix}-${type}`).length).toBe(1);
}, 0); }, 0);
}; };
['success', 'info', 'warning', 'error'].forEach(type => { await openNotificationWithIcon('success');
openNotificationWithIcon(type); await openNotificationWithIcon('info');
}); await openNotificationWithIcon('warning');
done(); await openNotificationWithIcon('error');
}); });
it('trigger onClick', () => { it('trigger onClick', () => {
@ -97,27 +97,27 @@ describe('notification', () => {
notification.open({ notification.open({
message: 'Notification Title', message: 'Notification Title',
duration: 0, duration: 0,
closeIcon: h => <StepBackwardOutlined />, closeIcon: <StepBackwardOutlined />,
}); });
}); });
await asyncExpect(() => { await asyncExpect(() => {
expect(document.querySelectorAll('.anticon-step-backward').length).toBe(1); expect(document.querySelectorAll('.anticon-step-backward').length).toBe(1);
}); }, 100);
}); });
it('support config closeIcon', async () => { it('support config closeIcon', async () => {
notification.config({ notification.config({
closeIcon: h => <StepBackwardOutlined />, closeIcon: <StepBackwardOutlined />,
}); });
await asyncExpect(() => { await asyncExpect(() => {
notification.open({ notification.open({
message: 'Notification Title', message: 'Notification Title',
duration: 0, duration: 0,
closeIcon: h => <StepBackwardOutlined />, closeIcon: <StepBackwardOutlined />,
}); });
}); });
await asyncExpect(() => { await asyncExpect(() => {
expect(document.querySelectorAll('.anticon-step-backward').length).toBe(1); expect(document.querySelectorAll('.anticon-step-backward').length).toBe(1);
}); }, 100);
}); });
}); });

View File

@ -426,7 +426,7 @@ describe('Table.filter', () => {
expect(renderedNames(wrapper)).toEqual(['Jack']); expect(renderedNames(wrapper)).toEqual(['Jack']);
}); });
it('confirm filter when dropdown hidden', async () => { fit('confirm filter when dropdown hidden', async () => {
const handleChange = jest.fn(); const handleChange = jest.fn();
const wrapper = mount(Table, { const wrapper = mount(Table, {
...getTableOptions({ ...getTableOptions({
@ -452,7 +452,8 @@ describe('Table.filter', () => {
await asyncExpect(() => { await asyncExpect(() => {
wrapper.find('.ant-dropdown-trigger').trigger('click'); wrapper.find('.ant-dropdown-trigger').trigger('click');
}, 500); }, 500);
await asyncExpect(() => {
expect(handleChange).toBeCalled(); expect(handleChange).toBeCalled();
}, 0);
}); });
}); });