From 074a3936ac96f677250a0698b70a6b967aedf8e7 Mon Sep 17 00:00:00 2001 From: kalykun <984757534@qq.com> Date: Sun, 29 Aug 2021 23:06:26 +0800 Subject: [PATCH] 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> --- src/ellipsis/tests/Ellipsis.spec.tsx | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/ellipsis/tests/Ellipsis.spec.tsx b/src/ellipsis/tests/Ellipsis.spec.tsx index c679c3271..1380fdc1e 100644 --- a/src/ellipsis/tests/Ellipsis.spec.tsx +++ b/src/ellipsis/tests/Ellipsis.spec.tsx @@ -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;' + ) + }) })