提交 76e5d7a2 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

新增 pages/API/create-selector-query/create-selector-query-onScroll 测试例

上级 d9153b7e
......@@ -1413,6 +1413,12 @@
"navigationBarTitleText": "createSelectorQuery | 创建 SelectorQuery 实例"
}
},
{
"path": "pages/API/create-selector-query/create-selector-query-onScroll",
"style": {
"navigationBarTitleText": "createSelectorQuery"
}
},
// #endif
// #ifdef APP-ANDROID || APP-IOS
{
......
const PAGE_PATH = '/pages/API/create-selector-query/create-selector-query-onScroll'
describe('create-selector-query-onScroll', () => {
// 先屏蔽 web 平台
if (
process.env.uniTestPlatformInfo.startsWith('web') ||
process.env.uniTestPlatformInfo.startsWith('mp')
) {
it('other platform', () => {
expect(1).toBe(1)
})
return
}
if (process.env.UNI_TEST_DEVICES_DIRECTION == 'landscape') {
it('跳过横屏模式', () => {
expect(1).toBe(1)
})
return
}
let page
beforeAll(async () => {
page = await program.reLaunch(PAGE_PATH)
await page.waitFor(500);
})
it('test-createSelectorQuery-onScroll', async () => {
let x = 100
let y = 250
// 滑动事件
await program.swipe({
startPoint: {x: x, y: y},
endPoint: {x: x,y: y-100},
duration: 300
})
await page.waitFor(600);
const ret = await page.data('ret')
expect(ret).toBe(true)
})
})
<template>
<scroll-view @scroll="onScroll" style="flex: 1;">
<view v-for="i in 60" class="content-item">
<text class="text">item-{{i}}</text>
</view>
</scroll-view>
</template>
<script>
export default {
data() {
return {
count: 0,
ret: true
}
},
onLoad() {
},
methods: {
onScroll() {
this.count++
console.log("scroll: ", this.count)
uni.createSelectorQuery()
.in(this)
.selectAll('content-item')
.boundingClientRect()
.exec((result) => {
this.count--
})
console.log("scroll: ", this.count)
if (this.count > 0) {
this.ret = false
}
}
}
}
</script>
<style>
</style>
......@@ -10,6 +10,7 @@ const sortTestFilePaths = [
"pages/component/swiper/swiper2.test.js",
"pages/component/slider/slider-maxValue.test.js",
"pages/CSS/overflow/overflow-visible-event.test.js",
"pages/API/create-selector-query/create-selector-query-onScroll.test.js",
"pages/component/rich-text/rich-text-complex.test.js"
]
class CustomSequencer extends Sequencer {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册