Skip to content

Commit 7f7511b

Browse files
committed
test: update test
1 parent f99200c commit 7f7511b

File tree

2 files changed

+14
-13
lines changed

2 files changed

+14
-13
lines changed

components/notification/__tests__/index.test.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ describe('notification', () => {
6666
notification.destroy();
6767
});
6868

69-
it('should be able to open with icon', done => {
69+
it('should be able to open with icon', async () => {
7070
const openNotificationWithIcon = async type => {
7171
const iconPrefix = '.ant-notification-notice-icon';
7272
notification[type]({
@@ -78,10 +78,10 @@ describe('notification', () => {
7878
expect(document.querySelectorAll(`${iconPrefix}-${type}`).length).toBe(1);
7979
}, 0);
8080
};
81-
['success', 'info', 'warning', 'error'].forEach(type => {
82-
openNotificationWithIcon(type);
83-
});
84-
done();
81+
await openNotificationWithIcon('success');
82+
await openNotificationWithIcon('info');
83+
await openNotificationWithIcon('warning');
84+
await openNotificationWithIcon('error');
8585
});
8686

8787
it('trigger onClick', () => {
@@ -97,27 +97,27 @@ describe('notification', () => {
9797
notification.open({
9898
message: 'Notification Title',
9999
duration: 0,
100-
closeIcon: h => <StepBackwardOutlined />,
100+
closeIcon: <StepBackwardOutlined />,
101101
});
102102
});
103103
await asyncExpect(() => {
104104
expect(document.querySelectorAll('.anticon-step-backward').length).toBe(1);
105-
});
105+
}, 100);
106106
});
107107

108108
it('support config closeIcon', async () => {
109109
notification.config({
110-
closeIcon: h => <StepBackwardOutlined />,
110+
closeIcon: <StepBackwardOutlined />,
111111
});
112112
await asyncExpect(() => {
113113
notification.open({
114114
message: 'Notification Title',
115115
duration: 0,
116-
closeIcon: h => <StepBackwardOutlined />,
116+
closeIcon: <StepBackwardOutlined />,
117117
});
118118
});
119119
await asyncExpect(() => {
120120
expect(document.querySelectorAll('.anticon-step-backward').length).toBe(1);
121-
});
121+
}, 100);
122122
});
123123
});

components/table/__tests__/Table.filter.test.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -426,7 +426,7 @@ describe('Table.filter', () => {
426426
expect(renderedNames(wrapper)).toEqual(['Jack']);
427427
});
428428

429-
it('confirm filter when dropdown hidden', async () => {
429+
fit('confirm filter when dropdown hidden', async () => {
430430
const handleChange = jest.fn();
431431
const wrapper = mount(Table, {
432432
...getTableOptions({
@@ -452,7 +452,8 @@ describe('Table.filter', () => {
452452
await asyncExpect(() => {
453453
wrapper.find('.ant-dropdown-trigger').trigger('click');
454454
}, 500);
455-
456-
expect(handleChange).toBeCalled();
455+
await asyncExpect(() => {
456+
expect(handleChange).toBeCalled();
457+
}, 0);
457458
});
458459
});

0 commit comments

Comments
 (0)