提交 3f91791c 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

Merge branch 'dev' of https://gitcode.net/dcloud/hello-uni-app-x into dev

* 'dev' of https://gitcode.net/dcloud/hello-uni-app-x:
  feat(navigator): 增加动画示例
  test: 增加issue/2199测试例
  调整map测试例
......@@ -1379,6 +1379,13 @@
"navigationBarTitleText": "nested-scroll-body"
}
},
{
"path": "pages/component/list-view/issue-2199",
"style": {
"navigationBarTitleText": "issue-2199",
"enablePullDownRefresh": false
}
},
// #ifdef APP || WEB
{
"path": "pages/API/request-payment/request-payment",
......
......@@ -41,11 +41,13 @@ describe('web-map', () => {
await page.callMethod('handleGetRegion')
await page.waitFor(500);
const regionRes = await page.data('getRegionTest')
const getRegionExpected = {
southwest: { latitude: 39.88334279187766, longitude: 116.31050146728515 },
northeast: { latitude: 40.0149408585477, longitude: 116.56799353271484 },
errMsg: 'getRegion:ok'
}
expect(regionRes).toEqual(expect.objectContaining(getRegionExpected));
console.log('regionRes', regionRes);
const {southwest,northeast} = regionRes;
const southwestExp ={ latitude: 39.88334279187766, longitude: 116.31050146728515 }
const northeastExp ={ latitude: 40.0149408585477, longitude: 116.56799353271484 }
expect(southwest.latitude).toBeCloseTo(southwestExp.latitude, 3);
expect(southwest.longitude).toBeCloseTo(southwestExp.longitude, 3);
expect(northeast.latitude).toBeCloseTo(northeastExp.latitude, 3);
expect(northeast.longitude).toBeCloseTo(northeastExp.longitude, 3);
});
});
......@@ -33,6 +33,7 @@
<button @tap="navigateTo" class="uni-btn">
跳转新页面,并传递数据
</button>
<button v-for="(item, _) in animationTypeList" @tap="navigateToAnimationType(item)" class="uni-btn">navigateTo({{item}})</button>
<button @tap="navigateBack" class="uni-btn">返回上一页</button>
<button @tap="redirectTo" class="uni-btn">在当前页面打开</button>
<button @tap="switchTab" class="uni-btn">切换到模板选项卡</button>
......@@ -60,6 +61,17 @@
onShowTime: 0,
onReadyTime: 0,
onHideTime: 0,
animationTypeList: [
'slide-in-right',
'slide-in-left',
'slide-in-top',
'slide-in-bottom',
'pop-in',
'fade-in',
'zoom-out',
'zoom-fade-out',
'none',
]
}
},
onLoad() {
......@@ -110,6 +122,30 @@
navigateTo() {
uni.navigateTo({
url: '/pages/API/navigator/new-page/new-page-1?data=Hello',
animationType: 'fade-in',
animationDuration: 200,
success(result) {
console.log('navigateTo success', result.errMsg)
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1)
},
fail(error) {
console.log('navigateTo fail', error.errMsg)
// 自动化测试
setLifeCycleNum(state.lifeCycleNum - 1)
},
complete(result) {
console.log('navigateTo complete', result.errMsg)
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1)
},
})
},
navigateToAnimationType(animationType: string) {
uni.navigateTo({
url: '/pages/API/navigator/new-page/new-page-1?data=Hello',
animationType: animationType,
animationDuration: 200,
success(result) {
console.log('navigateTo success', result.errMsg)
// 自动化测试
......
<template>
<list-item>
<slot></slot>
</list-item>
</template>
<script>
export default {
name: 'Item',
data() {
return {
}
},
methods: {
}
}
</script>
<style>
</style>
describe('issue-2199', () => {
let page
beforeAll(async () => {
page = await program.reLaunch('/pages/component/list-view/issue-2199')
await page.waitFor(600)
})
it('screenshot', async () => {
const image = await program.screenshot({
fullPage: true
});
expect(image).toSaveImageSnapshot();
})
})
<template>
<view>
<list-view>
<list-item>
<view class="title">
1
</view>
</list-item>
<Item>
<view class="title">
2
</view>
</Item>
</list-view>
</view>
</template>
<script>
import Item from './issue-2199-item.uvue'
export default {
components: {
Item
},
data() {
},
onLoad() {
},
methods: {
}
}
</script>
<style>
.title {
text-align: center;
justify-content: center;
align-items: center;
}
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册