Skip to content

Commit

Permalink
test(tree): add test (#3144)
Browse files Browse the repository at this point in the history
  • Loading branch information
XieZongChen authored Jun 20, 2022
1 parent a7f4d50 commit 881045a
Showing 1 changed file with 24 additions and 0 deletions.
24 changes: 24 additions & 0 deletions src/tree/tests/Tree.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
})

0 comments on commit 881045a

Please sign in to comment.