feat(Calendar): add top-info、bottom-info slot (#8716)

This commit is contained in:
neverland
2021-05-18 10:09:02 +08:00
committed by GitHub
parent c0fa715cf4
commit db41f5ad44
7 changed files with 82 additions and 21 deletions
@@ -924,6 +924,21 @@ exports[`row-height prop 1`] = `
</div>
`;
exports[`should render top-info and bottom-info slot correctly 1`] = `
<div role="gridcell"
style="margin-left: 71.42857142857143%;"
class="van-calendar__day van-calendar__day--disabled"
>
<div class="van-calendar__top-info">
top: 1
</div>
1
<div class="van-calendar__bottom-info">
bottom: 1
</div>
</div>
`;
exports[`title & footer slot 1`] = `
<div class="van-calendar">
<div class="van-calendar__header">
+20
View File
@@ -533,3 +533,23 @@ test('close event', async () => {
expect(onClose).toHaveBeenCalledTimes(1);
});
test('should render top-info and bottom-info slot correctly', async () => {
const wrapper = mount(Calendar, {
props: {
minDate,
maxDate,
poppable: false,
defaultDate: minDate,
lazyRender: false,
},
slots: {
'top-info': (item) => 'top: ' + item.text,
'bottom-info': (item) => 'bottom: ' + item.text,
},
});
await later();
expect(wrapper.find('.van-calendar__day').html()).toMatchSnapshot();
});