mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-03-07 13:48:31 +08:00
test(data-table): update test (#1273)
This commit is contained in:
parent
b688493c8e
commit
76d1190ff8
@ -558,4 +558,33 @@ describe('n-data-table', () => {
|
||||
))
|
||||
expect(wrapper.find('tbody').element.children.length).toBe(0)
|
||||
})
|
||||
|
||||
it('should work with `on-update:checked-row-keys` prop', async () => {
|
||||
const handleCheck = jest.fn()
|
||||
const columns: DataTableColumns = [
|
||||
{
|
||||
type: 'selection'
|
||||
},
|
||||
{
|
||||
title: 'Name',
|
||||
key: 'name'
|
||||
}
|
||||
]
|
||||
const data = new Array(2).fill(0).map((_, index) => {
|
||||
return {
|
||||
name: index
|
||||
}
|
||||
})
|
||||
const rowKey = (row: any): number => row.name
|
||||
const wrapper = mount(() => (
|
||||
<NDataTable
|
||||
columns={columns}
|
||||
data={data}
|
||||
row-key={rowKey}
|
||||
onUpdateCheckedRowKeys={handleCheck}
|
||||
/>
|
||||
))
|
||||
await wrapper.find('.n-checkbox').trigger('click')
|
||||
expect(handleCheck).toHaveBeenCalled()
|
||||
})
|
||||
})
|
||||
|
Loading…
Reference in New Issue
Block a user