mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-01-06 12:17:13 +08:00
test(data-table): update test (#1240)
This commit is contained in:
parent
93dffad0ea
commit
f8b196f207
@ -378,4 +378,32 @@ describe('n-data-table', () => {
|
||||
'width: 20px'
|
||||
)
|
||||
})
|
||||
|
||||
it('should work with `row-props` prop', async () => {
|
||||
const columns = [
|
||||
{
|
||||
title: 'Name',
|
||||
key: 'name'
|
||||
}
|
||||
]
|
||||
const data = new Array(978).fill(0).map((_, index) => {
|
||||
return {
|
||||
name: index
|
||||
}
|
||||
})
|
||||
const rowProps = (): any => ({
|
||||
style: 'cursor: pointer;'
|
||||
})
|
||||
let wrapper = mount(() => <NDataTable columns={columns} data={data} />)
|
||||
expect(wrapper.find('tbody .n-data-table-tr').attributes('style')).toBe(
|
||||
undefined
|
||||
)
|
||||
|
||||
wrapper = mount(() => (
|
||||
<NDataTable columns={columns} data={data} row-props={rowProps} />
|
||||
))
|
||||
expect(
|
||||
wrapper.find('tbody .n-data-table-tr').attributes('style')
|
||||
).toContain('cursor: pointer')
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user