diff --git a/packages/effects/common-ui/src/components/ellipsis-text/__tests__/ellipsis-text.test.ts b/packages/effects/common-ui/src/components/ellipsis-text/__tests__/ellipsis-text.test.ts index b297c3c9..9e2d13b8 100644 --- a/packages/effects/common-ui/src/components/ellipsis-text/__tests__/ellipsis-text.test.ts +++ b/packages/effects/common-ui/src/components/ellipsis-text/__tests__/ellipsis-text.test.ts @@ -31,9 +31,16 @@ describe('ellipsis-text.vue', () => { default: 'This is a very long text that should be truncated.', }, }); - const ellipsis = wrapper.find('.truncate'); + + // 点击 ellipsis,应该触发 expandChange,参数为 false await ellipsis.trigger('click'); expect(wrapper.emitted('expandChange')).toBeTruthy(); + expect(wrapper.emitted('expandChange')?.[0]).toEqual([true]); + + // 再次点击,应该触发 expandChange,参数为 false + await ellipsis.trigger('click'); + expect(wrapper.emitted('expandChange')?.length).toBe(2); + expect(wrapper.emitted('expandChange')?.[1]).toEqual([false]); }); }); diff --git a/packages/effects/common-ui/src/components/ellipsis-text/ellipsis-text.vue b/packages/effects/common-ui/src/components/ellipsis-text/ellipsis-text.vue index f57cccc9..4455a00a 100644 --- a/packages/effects/common-ui/src/components/ellipsis-text/ellipsis-text.vue +++ b/packages/effects/common-ui/src/components/ellipsis-text/ellipsis-text.vue @@ -1,5 +1,5 @@