Skip to content

Commit

Permalink
chore: 增加点击展开切换的测试
Browse files Browse the repository at this point in the history
  • Loading branch information
wangjue666 committed Aug 13, 2024
1 parent 9a1dd2e commit 2702894
Showing 1 changed file with 8 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
});
});

0 comments on commit 2702894

Please sign in to comment.