CN-1551 fix: 修复element-plus版本升级导致的单元测试用例报错的问题

This commit is contained in:
刘洪洪
2024-03-11 10:55:56 +08:00
parent f88fd3fae3
commit f05fa27375
2 changed files with 18 additions and 10 deletions

View File

@@ -464,7 +464,10 @@ export default {
}
}
},
addApp (pageNo, val, show) {
addApp (pageNo, val, show, index) {
if (!index) {
index = '0'
}
this.showAddApp = true
const params = {
startTime: getSecond(this.timeFilter.startTime),
@@ -484,7 +487,7 @@ export default {
} else {
params.pageNo = 1
}
if (parseFloat(this.appTypeTab) === 0) {
if (parseFloat(index) === 0) {
params.type = 'overviewProvide'
axios.get(api.dict, { params: params }).then(response => {
const res = response.data
@@ -508,7 +511,7 @@ export default {
this.loading = false
this.loadingBody = false
})
} else if (parseFloat(this.appTypeTab) === 1) {
} else if (parseFloat(index) === 1) {
params.type = 'overviewApp'
axios.get(api.dict, { params: params }).then(response => {
const res = response.data
@@ -547,10 +550,10 @@ export default {
cancelApp () {
this.showAddApp = false
},
appTypeTabChange () {
appTypeTabChange (n) {
this.pageObj.pageNo = 1
this.searcherApp = ''
this.addApp()
this.addApp('', '', '', n.index)
this.loadingBody = true
window.addEventListener('scroll', this.scrollChange, true)
this.timerScroll = setTimeout(() => {

View File

@@ -203,11 +203,16 @@ describe('单元测试demo', () => {
}
})
// 执行nextTick等待el-table渲染完成
await wrapper.vm.$nextTick()
const textNode = await wrapper.get('[test-id="name0"]')
const textNode2 = await wrapper.get('[test-id="age1"]')
expect(textNode.text()).toBe('a')
expect(textNode2.text()).toBe('11')
// await wrapper.vm.$nextTick()
await new Promise(resolve => setTimeout(async () => {
const textNode = await wrapper.get('[test-id="name0"]')
const textNode2 = await wrapper.get('[test-id="age1"]')
await wrapper.vm.$nextTick(() => {
expect(textNode.text()).toBe('a')
expect(textNode2.text()).toBe('11')
})
resolve()
}, 200))
})
test('js方法--getNameByEventType', async () => {
expect(getNameByEventType('http error')).toBe('http error ratio')