Skip to content

Commit

Permalink
Merge pull request #488 from jxzho/master
Browse files Browse the repository at this point in the history
完善 Input 测试用例,模拟鼠标进入后点击清除按钮的行为。
  • Loading branch information
Tyh2001 authored Jun 15, 2024
2 parents c1ecb14 + 9c0f402 commit 12ca672
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions packages/fighting-design/input/__test__/input.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ describe('Input', () => {
})

test('clicking `clear` icon should clear input value', async () => {
vi.useFakeTimers()
const wrapper = mount(FInput, {
props: {
clear: true,
Expand All @@ -160,6 +161,8 @@ describe('Input', () => {
}
}
})
await wrapper.find('.f-input__wrapper').trigger('mouseenter')
await vi.advanceTimersByTime(50)
expect(wrapper.find('.f-input__clear-btn').exists()).toBeTruthy()
await wrapper.find('.f-input__clear-btn').trigger('click')
expect(wrapper.props('modelValue')).toBe('')
Expand Down

0 comments on commit 12ca672

Please sign in to comment.