test: improve test cases typing (#8202)
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import { mount } from '../../../test';
|
||||
import ActionSheet, { ActionSheetAction } from '..';
|
||||
import ActionSheet from '..';
|
||||
|
||||
test('should emit select event after clicking option', () => {
|
||||
const wrapper = mount(ActionSheet, {
|
||||
@@ -11,9 +11,12 @@ test('should emit select event after clicking option', () => {
|
||||
|
||||
wrapper.find('.van-action-sheet__item').trigger('click');
|
||||
expect(wrapper.emitted('select').length).toEqual(1);
|
||||
expect(wrapper.emitted<[ActionSheetAction]>('select')[0][0]).toEqual({
|
||||
name: 'Option',
|
||||
});
|
||||
expect(wrapper.emitted('select')[0]).toEqual([
|
||||
{
|
||||
name: 'Option',
|
||||
},
|
||||
0,
|
||||
]);
|
||||
});
|
||||
|
||||
test('should call callback function after clicking option', () => {
|
||||
@@ -202,7 +205,7 @@ test('should close after clicking option if close-on-click-action prop is true',
|
||||
option.trigger('click');
|
||||
|
||||
expect(wrapper.emitted('update:show').length).toEqual(1);
|
||||
expect(wrapper.emitted<[boolean]>('update:show')[0][0]).toEqual(false);
|
||||
expect(wrapper.emitted('update:show')[0]).toEqual([false]);
|
||||
});
|
||||
|
||||
test('should emit click-overlay event and closed after clicking the overlay', () => {
|
||||
@@ -215,7 +218,7 @@ test('should emit click-overlay event and closed after clicking the overlay', ()
|
||||
});
|
||||
|
||||
wrapper.find('.van-overlay').trigger('click');
|
||||
expect(wrapper.emitted<[boolean]>('update:show')[0][0]).toEqual(false);
|
||||
expect(wrapper.emitted('update:show')[0]).toEqual([false]);
|
||||
expect(onClickOverlay).toHaveBeenCalledTimes(1);
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user