feat(Calendar): add readonly prop (#7115)
This commit is contained in:
@@ -213,3 +213,25 @@ test('first day of week', async () => {
|
||||
expect(day.text()).toEqual('1');
|
||||
expect(day.attributes('style')).toContain(`margin-left: ${(100 * 4) / 7}%`);
|
||||
});
|
||||
|
||||
test('readonly prop', async () => {
|
||||
const wrapper = mount(Calendar, {
|
||||
propsData: {
|
||||
type: 'multiple',
|
||||
minDate,
|
||||
maxDate,
|
||||
readonly: true,
|
||||
poppable: false,
|
||||
},
|
||||
});
|
||||
|
||||
await later();
|
||||
|
||||
const days = wrapper.findAll('.van-calendar__day');
|
||||
days.at(13).trigger('click');
|
||||
expect(wrapper.emitted('select')).toBeFalsy();
|
||||
|
||||
wrapper.setProps({ readonly: false });
|
||||
days.at(13).trigger('click');
|
||||
expect(wrapper.emitted('select')).toBeTruthy();
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user