fix(DateTimePicker): fix action when max-hour or max-minute is set smaller then current time(#5005) (#5006)

This commit is contained in:
tango5614
2019-11-14 19:09:19 +08:00
committed by neverland
parent 7aee4fb9a2
commit 4c9eb995d4
2 changed files with 19 additions and 3 deletions
@@ -107,3 +107,19 @@ test('change min-minute and emit correct value', async () => {
wrapper.find('.van-picker__confirm').trigger('click');
expect(wrapper.emitted('confirm')[0][0]).toEqual('12:30');
});
test('set max-hour & max-minute smaller than current then emit correct value', async () => {
const wrapper = mount(TimePicker, {
propsData: {
value: '23:59',
}
});
await later();
wrapper.setProps({
maxHour: 2,
maxMinute: 2,
});
wrapper.find('.van-picker__confirm').trigger('click');
expect(wrapper.emitted('confirm')[0][0]).toEqual('00:00');
});