test(tree): add test (#3144)

This commit is contained in:
XieZongChen 2022-06-20 23:37:57 +08:00 committed by GitHub
parent a7f4d50beb
commit 881045a1d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -450,4 +450,28 @@ describe('n-tree', () => {
await node[0].trigger('click')
expect(wrapper.findAll('.n-tree-node--selected').length).toBe(2)
})
it('should work with `node-props` prop', async () => {
const testClass = 'menu-test'
const wrapper = mount(NTree, {
props: {
data: [
{
label: '1',
key: '1'
},
{
label: '2',
key: '2'
},
{
label: '3',
key: '3'
}
],
nodeProps: () => ({ class: testClass })
}
})
expect(wrapper.find('.n-tree-node').classes()).toContain(testClass)
})
})