feat(DatetimePicker): support picker slots (#7645)

This commit is contained in:
neverland
2020-11-26 19:57:28 +08:00
committed by GitHub
parent 488d90aab9
commit d3f38c29f9
6 changed files with 41 additions and 0 deletions
@@ -1,5 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP
exports[`should render title slot correctly 1`] = `<div class="van-picker__toolbar"><button type="button" class="van-picker__cancel">取消</button>Custom title<button type="button" class="van-picker__confirm">确认</button></div>`;
exports[`time type 1`] = `
<div class="van-picker van-datetime-picker">
<div class="van-picker__toolbar"><button type="button" class="van-picker__cancel">取消</button><button type="button" class="van-picker__confirm">确认</button></div>
@@ -35,3 +35,16 @@ test('getPicker method', () => {
const wrapper = mount(DatetimePicker);
expect(wrapper.vm.getPicker()).toBeTruthy();
});
test('should render title slot correctly', () => {
const wrapper = mount(DatetimePicker, {
propsData: {
showToolbar: true,
},
scopedSlots: {
title: () => 'Custom title',
},
});
expect(wrapper.find('.van-picker__toolbar')).toMatchSnapshot();
});