Skip to content

Commit

Permalink
fix(components): [table-v2] header-cell slots invalid (#9585)
Browse files Browse the repository at this point in the history
  • Loading branch information
btea committed Sep 1, 2022
1 parent 198dd0a commit 8fb1d45
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
21 changes: 21 additions & 0 deletions packages/components/table-v2/__tests__/table-v2.test.tsx
Expand Up @@ -51,4 +51,25 @@ describe('TableV2.vue', () => {
expect(cell.exists()).toBe(true)
expect(cell.find('span').text()).toBe(customText)
})

test('slots header-cell', async () => {
const columns = ref(generateColumns(10))
const data = ref(generateData(columns.value, 20))
const customText = 'header'
const wrapper = mount(() => (
<TableV2
columns={columns.value}
data={data.value}
width={700}
height={400}
v-slots={{
'header-cell': () => <span>{customText}</span>,
}}
/>
))
expect(wrapper.find('.el-table-v2').exists()).toBe(true)
const cell = wrapper.find('.el-table-v2__header-cell')
expect(cell.exists()).toBe(true)
expect(cell.find('span').text()).toBe(customText)
})
})
2 changes: 1 addition & 1 deletion packages/components/table-v2/src/table-v2.tsx
Expand Up @@ -293,7 +293,7 @@ const TableV2 = defineComponent({
{...tableHeaderCellProps}
style={_columnsStyles[props.column.key]}
>
{slots['header-cell']}
{slots['header-cell']()}
</HeaderCell>
) : (
<HeaderCell
Expand Down

0 comments on commit 8fb1d45

Please sign in to comment.