提交 08265317 编写于 作者: W wangjinxin613

test: 解决无法触发 onPullDownRefresh 生命周期导致测试例失败的问题

上级 63e433a2
......@@ -34,7 +34,7 @@
success() {
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1000)
}, 1500)
},
})
}
......
......@@ -11,90 +11,90 @@
<!-- #endif -->
</template>
<script setup>
import { state, setLifeCycleNum } from '@/store/index.uts'
const isScrolled = ref(false)
<script setup>
import { state, setLifeCycleNum } from '@/store/index.uts'
const isScrolled = ref(false)
onLoad((_: OnLoadOptions) => {
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 100)
})
onPageShow(() => {
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
})
onReady(() => {
// 自动化测试
onReady(() => {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
})
onPullDownRefresh(() => {
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
})
onPageScroll((_) => {
onPageScroll((_) => {
// 自动化测试
isScrolled.value = true
})
onReachBottom(() => {
onReachBottom(() => {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
})
onBackPress((_: OnBackPressOptions): boolean | null => {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 10)
onBackPress((_: OnBackPressOptions): boolean | null => {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 10)
return null
})
onPageHide(() => {
onPageHide(() => {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 10)
})
onUnload(() => {
onUnload(() => {
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 100)
})
onResize((_) => {
// 自动化测试
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 10)
})
// 自动化测试
const getLifeCycleNum = () : number => {
return state.lifeCycleNum
}
// 自动化测试
const pageSetLifeCycleNum = (num: number) => {
setLifeCycleNum(num)
}
// 自动化测试
const pullDownRefresh = () => {
uni.startPullDownRefresh({
success() {
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1000)
},
})
}
})
// 自动化测试
const getLifeCycleNum = () : number => {
return state.lifeCycleNum
}
// 自动化测试
const pageSetLifeCycleNum = (num: number) => {
setLifeCycleNum(num)
}
// 自动化测试
const pullDownRefresh = () => {
uni.startPullDownRefresh({
success() {
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1500)
},
})
}
const scrollToBottom = () => {
uni.pageScrollTo({
scrollTop: 2000,
})
}
// 自动化测试
const getIsScrolled = (): boolean => {
return isScrolled.value
}
defineExpose({
getLifeCycleNum,
pageSetLifeCycleNum,
pullDownRefresh,
scrollToBottom,
getIsScrolled
}
// 自动化测试
const getIsScrolled = (): boolean => {
return isScrolled.value
}
defineExpose({
getLifeCycleNum,
pageSetLifeCycleNum,
pullDownRefresh,
scrollToBottom,
getIsScrolled
})
</script>
......
......@@ -76,7 +76,8 @@ export default {
success() {
setTimeout(() => {
uni.stopPullDownRefresh()
}, 1000)
// 一秒后立即停止下拉刷新不会触发 onPullDownRefresh,因为下拉动画时间大概需要1.1~1.2秒
}, 1500)
},
})
},
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册