[improvement] DatetimePicker: add more test cases (#4029)

This commit is contained in:
neverland
2019-08-02 11:19:28 +08:00
committed by GitHub
parent 70a014e388
commit 6dc1af7ff0
2 changed files with 60 additions and 0 deletions
@@ -0,0 +1,32 @@
import DatetimePicker from '..';
import { mount } from '../../../test/utils';
test('confirm & cancel event', () => {
const onConfirm = jest.fn();
const onCancel = jest.fn();
const wrapper = mount(DatetimePicker, {
listeners: {
confirm: onConfirm,
cancel: onCancel
}
});
wrapper.find('.van-picker__confirm').trigger('click');
expect(onConfirm).toHaveBeenCalledTimes(1);
wrapper.find('.van-picker__cancel').trigger('click');
expect(onCancel).toHaveBeenCalledTimes(1);
});
test('time type', () => {
const wrapper = mount(DatetimePicker, {
propsData: {
type: 'time',
minHour: 22,
minMinute: 58
}
});
expect(wrapper).toMatchSnapshot();
});