提交 39fcbe54 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

添加 slider 最大值溢出测试

(cherry picked from commit a541f83c)
上级 109354ef
......@@ -220,6 +220,12 @@
"navigationBarTitleText": "slider-in-swiper"
}
},
{
"path": "pages/component/slider/slider-maxValue",
"style": {
"navigationBarTitleText": "slider-maxValue-test"
}
},
{
"path": "pages/component/picker-view/picker-view",
"group": "0,3,7",
......
const PAGE_PATH = '/pages/component/slider/slider-maxValue'
describe('touch-events-test', () => {
// 先屏蔽 android 及 web 平台
if (process.env.uniTestPlatformInfo.startsWith('android') || process.env.uniTestPlatformInfo.startsWith('web')) {
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-slider-max-value', async () => {
let iconRect = await page.data('sliderRect')
let x = iconRect.x + 15
let y = iconRect.y + 15
// 滑动事件
await program.swipe({
startPoint: {x: x, y: y},
endPoint: {x: x+1000,y: y},
duration: 300
})
await page.waitFor(600);
const ret = await page.data('sliderValue')
expect(ret).toBe(10)
})
})
<template>
<view class="uni-padding-wrap">
<view class="uni-title">最大值溢出测试(不能滑动到最右侧)</view>
<view>
<slider id="slider" :value="0" :min="0" :max="10.5" :step="1" :show-value="true" @change="valueChange"/>
</view>
</view>
</template>
<script>
export default {
data() {
return {
sliderRect: null as DOMRect | null,
sliderValue: 0
}
},
onReady() {
// #ifdef APP-IOS
let sliderEle = uni.getElementById("slider")
this.sliderRect = sliderEle?.getBoundingClientRect()
// 加上导航栏及状态栏高度
this.sliderRect.y += uni.getSystemInfoSync().safeArea.top + 44
// #endif
},
methods: {
valueChange(e) {
console.log('valueChange', e.detail.value)
this.sliderValue = e.detail.value
}
}
}
</script>
<style>
</style>
......@@ -8,6 +8,7 @@ const sortTestFilePaths = [
"pages/component/global-events/touch-events.test.js",
"pages/component/global-events/touch-events-bubbles.test.js",
"pages/component/swiper/swiper2.test.js",
"pages/component/slider/slider-maxValue.test.js",
"pages/CSS/overflow/overflow-visible-event.test.js",
"pages/component/rich-text/rich-text-complex.test.js"
]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册