test(data-table): update test (#1240)

This commit is contained in:
XieZongChen 2021-09-25 21:10:38 -05:00 committed by GitHub
parent 93dffad0ea
commit f8b196f207
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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')
})
})