Skip to content

Commit 7b543ea

Browse files
authored
fix(datepicker): Fix day content slot regression (sumcumo#118)
1 parent 021d4e6 commit 7b543ea

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

src/components/PickerDay.vue

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@
3838
view="day"
3939
@select="select($event)"
4040
>
41-
{{ dayCellContent(cell) }}
41+
<slot name="dayCellContent" :cell="cell">
42+
{{ dayCellContent(cell) }}
43+
</slot>
4244
</PickerCells>
4345
</Transition>
4446
</div>

test/unit/specs/PickerDay/pickerDay.spec.js

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,3 +155,23 @@ describe('PickerDay', () => {
155155
expect(cellClasses[2].selected).toBeFalsy()
156156
})
157157
})
158+
159+
describe('PickerDay with scoped slot', () => {
160+
it('displays the dayCellContent scoped slot correctly', () => {
161+
const wrapper = mount(PickerDay, {
162+
propsData: {
163+
translation: en,
164+
pageDate: new Date(2018, 1, 1),
165+
},
166+
scopedSlots: {
167+
dayCellContent: `<template #dayCellContent="{ cell }">
168+
<span>test{{ cell.date }}</span>
169+
</template>`,
170+
},
171+
})
172+
173+
const firstCell = wrapper.find('.cell')
174+
175+
expect(firstCell.text()).toBe('test28')
176+
})
177+
})

0 commit comments

Comments
 (0)