test(ellipsis): add test case (#1010)

* test(ellipsis): add test case

* Update src/ellipsis/tests/Ellipsis.spec.tsx

Co-authored-by: 07akioni <07akioni2@gmail.com>
This commit is contained in:
kalykun 2021-08-29 23:06:26 +08:00 committed by GitHub
parent 70fafa6e64
commit 074a3936ac
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -39,4 +39,24 @@ describe('n-ellipsis', () => {
'n-ellipsis--line-clamp'
)
})
it('should work with `expand-trigger` prop', async () => {
const wrapper = mount(NEllipsis, {
props: {
expandTrigger: 'click',
tooltip: false
},
slots: { default: () => 'test n-ellipsis' }
})
await wrapper.trigger('click')
expect(wrapper.find('.n-ellipsis').attributes('style')).not.toContain(
'text-overflow: ellipsis;'
)
await wrapper.trigger('click')
expect(wrapper.find('.n-ellipsis').attributes('style')).toContain(
'text-overflow: ellipsis;'
)
})
})