mirror of
https://github.com/tusen-ai/naive-ui.git
synced 2025-04-12 14:40:47 +08:00
test(countdown): add test (#3257)
This commit is contained in:
parent
ffe8af94fc
commit
70708a4f34
@ -1,4 +1,5 @@
|
||||
import { mount } from '@vue/test-utils'
|
||||
import { sleep } from 'seemly'
|
||||
import { CountdownProps, NCountdown } from '../index'
|
||||
|
||||
describe('n-countdown', () => {
|
||||
@ -46,4 +47,16 @@ describe('n-countdown', () => {
|
||||
})
|
||||
expect(wrapper.text()).not.toBe('1:1:1:1')
|
||||
})
|
||||
it('should work with `on-finish` prop', async () => {
|
||||
const onFinish = jest.fn()
|
||||
const wrapper = mount(NCountdown, {
|
||||
props: {
|
||||
duration: 1,
|
||||
onFinish
|
||||
}
|
||||
})
|
||||
await sleep(100)
|
||||
expect(onFinish).toHaveBeenCalled()
|
||||
wrapper.unmount()
|
||||
})
|
||||
})
|
||||
|
Loading…
x
Reference in New Issue
Block a user