test(log): update test (#1657)

This commit is contained in:
XieZongChen 2021-11-23 02:26:35 -06:00 committed by GitHub
parent 0ac58d8645
commit 376110d8fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -31,4 +31,21 @@ describe('n-log', () => {
`line-height: ${lineHeight}`
)
})
it('should work with `lines` `log` prop', async () => {
const wrapper = mount(NLog, { props: { lines: ['test1', 'test2'] } })
expect(wrapper.find('.n-code').element.children.length).toBe(2)
expect(wrapper.find('.n-code').element.children[0].textContent).toBe(
'test1'
)
expect(wrapper.find('.n-code').element.children[1].textContent).toBe(
'test2'
)
await wrapper.setProps({ log: 'test3' })
expect(wrapper.find('.n-code').element.children.length).toBe(1)
expect(wrapper.find('.n-code').element.children[0].textContent).toBe(
'test3'
)
})
})