mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-12 10:45:10 +08:00
test(components): [el-config-provider] use useFakeTimers (#5228)
* fix(components): modify config-provider sleep time * test: use useFakeTimers
This commit is contained in:
parent
f41f3f8dd5
commit
e3417babe2
@ -4,10 +4,12 @@ import { useLocale } from '@element-plus/hooks'
|
||||
import Chinese from '@element-plus/locale/lang/zh-cn'
|
||||
import English from '@element-plus/locale/lang/en'
|
||||
import { ElButton, ElMessage } from '@element-plus/components'
|
||||
import { sleep } from '@element-plus/test-utils'
|
||||
import { rAF } from '@element-plus/test-utils/tick'
|
||||
import ConfigProvider from '../src/config-provider'
|
||||
import type { Language } from '@element-plus/locale'
|
||||
|
||||
jest.useFakeTimers()
|
||||
|
||||
const TestComp = {
|
||||
setup() {
|
||||
const { t } = useLocale()
|
||||
@ -195,8 +197,8 @@ describe('config-provider', () => {
|
||||
</el-config-provider>
|
||||
`,
|
||||
})
|
||||
ElMessage.closeAll()
|
||||
await sleep(40)
|
||||
jest.runAllTimers()
|
||||
await rAF()
|
||||
wrapper.find('.el-button').trigger('click')
|
||||
wrapper.find('.el-button').trigger('click')
|
||||
wrapper.find('.el-button').trigger('click')
|
||||
|
Loading…
Reference in New Issue
Block a user