mirror of
https://github.com/element-plus/element-plus.git
synced 2025-01-18 10:59:10 +08:00
fix(message-box): - fix message box unit test error (#433)
This commit is contained in:
parent
2d13a7091b
commit
f4f81af246
@ -1,5 +1,6 @@
|
||||
import MessageBox from '../src/messageBox'
|
||||
import { sleep } from '@element-plus/test-utils'
|
||||
import { nextTick } from 'vue'
|
||||
|
||||
const selector = '.el-message-box__wrapper'
|
||||
|
||||
@ -155,6 +156,7 @@ describe('MessageBox', () => {
|
||||
})
|
||||
await sleep();
|
||||
(document.querySelector('.el-message-box__wrapper .el-button--primary') as HTMLButtonElement).click()
|
||||
await nextTick()
|
||||
await sleep()
|
||||
expect(msgAction).toEqual('confirm')
|
||||
})
|
||||
|
@ -219,12 +219,11 @@ export default defineComponent({
|
||||
|
||||
const confirmButtonClasses = computed(() => `el-button--primary ${ state.confirmButtonClass }`)
|
||||
|
||||
watch(() => state.inputValue, val => {
|
||||
nextTick().then(() => {
|
||||
if (state.type$ === 'prompt' && val !== null) {
|
||||
validate()
|
||||
}
|
||||
})
|
||||
watch(() => state.inputValue, async val => {
|
||||
await nextTick()
|
||||
if (state.type$ === 'prompt' && val !== null) {
|
||||
validate()
|
||||
}
|
||||
}, { immediate: true })
|
||||
|
||||
watch(() => state.visible, val => {
|
||||
@ -276,10 +275,10 @@ export default defineComponent({
|
||||
|
||||
function getSafeClose () {
|
||||
const currentId = state.uid
|
||||
return () => {
|
||||
nextTick().then(() => {
|
||||
if (currentId === state.uid) doClose()
|
||||
})
|
||||
return async () => {
|
||||
|
||||
await nextTick()
|
||||
if (currentId === state.uid) doClose()
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user