提交 22a5e165 编写于 作者: 辛宝Otto's avatar 辛宝Otto 🥊

Merge branch 'feature/uni-enterLaunchOptioons' into 'dev'

Feature/uni enter launch optioons

See merge request !46
......@@ -20,9 +20,17 @@
myMap: new Map<string, any>(),
func: () : string => {
return 'globalData func'
}
},
launchOptions: {
path: '',
} as OnLaunchOptions,
onShowOption: {
path: ''
} as OnShowOptions
},
onLaunch: function () {
onLaunch: function (res : OnLaunchOptions) {
this.globalData.launchOptions = res
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 1000)
console.log('App Launch')
......@@ -38,7 +46,9 @@
// entryTypes: ['render', 'navigation'],
// } as PerformanceObserverOptions)
},
onShow: function () {
onShow: function (res : OnShowOptions) {
this.globalData.onShowOption = res
// 自动化测试
setLifeCycleNum(state.lifeCycleNum + 100)
console.log('App Show')
......@@ -83,12 +93,15 @@
<style>
/*每个页面公共css */
@import "./common/uni.css";
/* #ifdef WEB */
.uni-top-window uni-tabbar .uni-tabbar {
background-color: #fff !important;
background-color: #fff !important;
}
.uni-app--showleftwindow .uni-page-head-btn {
display: none !important;
display: none !important;
}
/* #endif */
</style>
......@@ -8,4 +8,27 @@ describe('getLaunchOptionsSync', () => {
const data = await page.data()
expect(data.checked).toBe(true)
})
it('app onLaunch 和 getLaunchOptionsSync 结果一致', async () => {
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('android')) {
// if android return
expect(1).toBe(1)
}
const page = await program.navigateTo(PAGE_PATH)
await page.waitFor('view')
const res = await page.callMethod('compareOnLaunchRes')
expect(res.appOnLaunch).toEqual(res.launchOptions)
})
it('app onShow 和 getEnterOptionsSync 结果一致', async () => {
if (process.env.uniTestPlatformInfo.toLowerCase().startsWith('android')) {
// if android return
expect(1).toBe(1)
}
const page = await program.navigateTo(PAGE_PATH)
await page.waitFor('view')
const res = await page.callMethod('compareOnShowRes')
expect(res.appOnShow).toEqual(res.onShowOption)
})
})
......@@ -20,6 +20,41 @@ export default {
}
},
methods: {
// 自动化测试
compareOnLaunchRes() {
// #ifdef APP-ANDROID
return {
appOnLaunch: {},
launchOptions: {}
}
// #endif
// #ifndef APP-ANDROID
const launchOptions = uni.getLaunchOptionsSync();
const app = getApp()
const appOnLaunch = app.globalData.launchOptions;
return {
appOnLaunch,
launchOptions
}
// #endif
},
compareOnShowRes() {
const onShowOption = uni.getEnterOptionsSync();
const app = getApp()
const appOnShow = app.globalData.onShowOption
return {
appOnShow,
onShowOption
}
},
getLaunchOptionsSync() {
const launchOptions = uni.getLaunchOptionsSync()
this.launchOptionsPath = launchOptions.path
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册