feat(Calendar): add readonly prop (#7115)

This commit is contained in:
neverland
2020-09-05 15:04:16 +08:00
committed by GitHub
parent e7deea7195
commit afb8ac5443
4 changed files with 29 additions and 0 deletions
+22
View File
@@ -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();
});