feat(Calendar): add show-subtitle prop (#5779)

This commit is contained in:
chenjiahan
2020-03-09 20:55:20 +08:00
parent e575bb4bb1
commit 17ecc980a7
9 changed files with 64 additions and 23 deletions
+29 -2
View File
@@ -25,15 +25,42 @@ test('max-range prop', async () => {
expect(wrapper.emitted('confirm')).toBeFalsy();
});
test('show-title prop', async () => {
test('show-title prop', () => {
const wrapper = mount(Calendar, {
propsData: {
value: true,
},
});
await later();
expect(wrapper.contains('.van-calendar__header-title')).toBeTruthy();
wrapper.setProps({ showTitle: false });
expect(wrapper.contains('.van-calendar__header-title')).toBeFalsy();
});
test('show-subtitle prop', () => {
const wrapper = mount(Calendar, {
propsData: {
value: true,
},
});
expect(wrapper.contains('.van-calendar__header-subtitle')).toBeTruthy();
wrapper.setProps({ showSubtitle: false });
expect(wrapper.contains('.van-calendar__header-subtitle')).toBeFalsy();
});
test('hide close icon when there is no title', () => {
const wrapper = mount(Calendar, {
propsData: {
value: true,
},
});
expect(wrapper.contains('.van-popup__close-icon')).toBeTruthy();
wrapper.setProps({
showTitle: false,
showSubtitle: false,
});
expect(wrapper.contains('.van-popup__close-icon')).toBeFalsy();
});