mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-03-07 13:48:31 +08:00
test(data-table): update test (#1331)
This commit is contained in:
parent
2921860be1
commit
fb9beb6d3c
@ -947,7 +947,7 @@ describe('props.columns', () => {
|
||||
)
|
||||
})
|
||||
|
||||
it('should work with `ellipsis` prop', async () => {
|
||||
it('should work with `children` prop', async () => {
|
||||
const columns: DataTableColumns = [
|
||||
{
|
||||
title: 'Name',
|
||||
@ -1007,4 +1007,35 @@ describe('props.columns', () => {
|
||||
wrapper.find('thead [data-col-key="test2"]').attributes('rowspan')
|
||||
).toBe('1')
|
||||
})
|
||||
|
||||
it('should work with `className` prop', async () => {
|
||||
const columns: DataTableColumns = [
|
||||
{
|
||||
title: 'Name',
|
||||
key: 'name',
|
||||
className: 'test-name'
|
||||
},
|
||||
{
|
||||
title: 'Age',
|
||||
key: 'age',
|
||||
className: 'test-age'
|
||||
}
|
||||
]
|
||||
const data = new Array(5).fill(0).map((_, index) => {
|
||||
return {
|
||||
name: index,
|
||||
age: index
|
||||
}
|
||||
})
|
||||
const rowKey = (row: any): number => row.name
|
||||
const wrapper = mount(() => (
|
||||
<NDataTable columns={columns} data={data} row-key={rowKey} />
|
||||
))
|
||||
expect(wrapper.find('thead [data-col-key="name"]').classes()).toContain(
|
||||
'test-name'
|
||||
)
|
||||
expect(wrapper.find('thead [data-col-key="age"]').classes()).toContain(
|
||||
'test-age'
|
||||
)
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user