mirror of
https://gitee.com/vant-contrib/vant.git
synced 2025-04-06 03:57:59 +08:00
test(Calendar): add max-range test case
This commit is contained in:
parent
038b622e9d
commit
13bbd73141
@ -385,3 +385,5 @@ export default createComponent({
|
|||||||
return this.genCalendar();
|
return this.genCalendar();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// todo
|
||||||
|
@ -43,6 +43,10 @@ exports[`renders demo correctly 1`] = `
|
|||||||
<div class="van-cell__title"><span>自定义弹出位置</span></div><i class="van-icon van-icon-arrow van-cell__right-icon">
|
<div class="van-cell__title"><span>自定义弹出位置</span></div><i class="van-icon van-icon-arrow van-cell__right-icon">
|
||||||
<!----></i>
|
<!----></i>
|
||||||
</div>
|
</div>
|
||||||
|
<div role="button" tabindex="0" class="van-cell van-cell--clickable">
|
||||||
|
<div class="van-cell__title"><span>日期区间最大范围</span></div><i class="van-icon van-icon-arrow van-cell__right-icon">
|
||||||
|
<!----></i>
|
||||||
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div>
|
<div>
|
||||||
<div class="van-calendar" style="height: 500px;">
|
<div class="van-calendar" style="height: 500px;">
|
||||||
|
@ -427,3 +427,24 @@ test('should scroll to current month when show', async done => {
|
|||||||
|
|
||||||
await later();
|
await later();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
test('max-range prop', async () => {
|
||||||
|
const wrapper = mount(Calendar, {
|
||||||
|
propsData: {
|
||||||
|
type: 'range',
|
||||||
|
minDate,
|
||||||
|
maxDate,
|
||||||
|
maxRange: 1,
|
||||||
|
poppable: false
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
await later();
|
||||||
|
|
||||||
|
const days = wrapper.findAll('.van-calendar__day');
|
||||||
|
days.at(15).trigger('click');
|
||||||
|
days.at(18).trigger('click');
|
||||||
|
wrapper.find('.van-calendar__confirm').trigger('click');
|
||||||
|
|
||||||
|
expect(wrapper.emitted('confirm')).toBeFalsy();
|
||||||
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user