提交 d052aa4f 编写于 作者: DCloud-WZF's avatar DCloud-WZF 💬

feat: 部分示例及测试支持 harmony

上级 e162dfe4
<template> <template>
<view> <view>
<call-easy-method-uni-modules ref="callEasyMethod1"></call-easy-method-uni-modules> <call-easy-method-uni-modules ref="callEasyMethod1"></call-easy-method-uni-modules>
<!-- #ifdef APP-ANDROID || APP-IOS --> <!-- #ifdef APP-ANDROID || APP-IOS || APP-HARMONY -->
<!-- 在兼容组件中 ios 返回非普通对象数据,比如 Map 数据时候会被 jscore 统一处理为 object,和安卓产生了差异 --> <!-- 在兼容组件中 ios 返回非普通对象数据,比如 Map 数据时候会被 jscore 统一处理为 object,和安卓产生了差异 -->
<!-- 测试用例用来验证返回数据特殊,安卓和其他平台无此限制 --> <!-- 测试用例用来验证返回数据特殊,安卓和其他平台无此限制 -->
<view>---</view> <view>---</view>
...@@ -83,7 +83,7 @@ ...@@ -83,7 +83,7 @@
} }
// #endif // #endif
// #ifdef APP-IOS // #ifdef APP-IOS || APP-HARMONY
const numListChange = (res : any) => { const numListChange = (res : any) => {
const value = res['detail']!['value'] as number[] const value = res['detail']!['value'] as number[]
const isArray = Array.isArray(value) const isArray = Array.isArray(value)
...@@ -102,7 +102,7 @@ ...@@ -102,7 +102,7 @@
} }
// #endif // #endif
// #ifdef APP-IOS // #ifdef APP-IOS || APP-HARMONY
const objListChange = (res : any) => { const objListChange = (res : any) => {
const value = res['detail']!['value'] as any[] const value = res['detail']!['value'] as any[]
const isArray = Array.isArray(value) const isArray = Array.isArray(value)
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
<view> <view>
<call-easy-method-uni-modules ref="callEasyMethod1"></call-easy-method-uni-modules> <call-easy-method-uni-modules ref="callEasyMethod1"></call-easy-method-uni-modules>
<!-- #ifdef APP-IOS || APP-ANDROID --> <!-- #ifdef APP-IOS || APP-ANDROID || APP-HARMONY -->
<!-- 在兼容组件中 ios 返回非普通对象数据,比如 Map 数据时候会被 jscore 统一处理为 object,和安卓产生了差异 --> <!-- 在兼容组件中 ios 返回非普通对象数据,比如 Map 数据时候会被 jscore 统一处理为 object,和安卓产生了差异 -->
<!-- 测试用例用来验证返回数据特殊,安卓和其他平台无此限制 --> <!-- 测试用例用来验证返回数据特殊,安卓和其他平台无此限制 -->
<view>---</view> <view>---</view>
...@@ -101,7 +101,7 @@ ...@@ -101,7 +101,7 @@
this.isNumListValid = isArray && isLengthGt0 this.isNumListValid = isArray && isLengthGt0
}, },
// #endif // #endif
// #ifdef APP-IOS // #ifdef APP-IOS || APP-HARMONY
numListChange(res : any) { numListChange(res : any) {
const value = res['detail']!['value'] as number[] const value = res['detail']!['value'] as number[]
const isArray = Array.isArray(value) const isArray = Array.isArray(value)
...@@ -118,7 +118,7 @@ ...@@ -118,7 +118,7 @@
this.isObjListValid = isArray && isLengthGt0 this.isObjListValid = isArray && isLengthGt0
}, },
// #endif // #endif
// #ifdef APP-IOS // #ifdef APP-IOS || APP-HARMONY
objListChange(res : any) { objListChange(res : any) {
const value = res['detail']!['value'] as number[] const value = res['detail']!['value'] as number[]
const isArray = Array.isArray(value) const isArray = Array.isArray(value)
......
...@@ -5,14 +5,11 @@ const platformInfo = process.env.uniTestPlatformInfo.toLowerCase() ...@@ -5,14 +5,11 @@ const platformInfo = process.env.uniTestPlatformInfo.toLowerCase()
const isIOS = platformInfo.startsWith('ios') const isIOS = platformInfo.startsWith('ios')
const isWeb = platformInfo.startsWith('web') const isWeb = platformInfo.startsWith('web')
const isMP = platformInfo.startsWith('mp') const isMP = platformInfo.startsWith('mp')
// TODO: harmony 进入页面再退出崩溃
const isHarmony = platformInfo.includes('harmony')
describe('call method easycom uni modules', () => { describe('call method easycom uni modules', () => {
if ( if (
isMP || isMP ||
isWeb || isWeb ||
isHarmony ||
( (
isIOS && isIOS &&
( (
......
...@@ -5,7 +5,7 @@ describe('v-on', () => { ...@@ -5,7 +5,7 @@ describe('v-on', () => {
const platformInfo = process.env.uniTestPlatformInfo.toLowerCase() const platformInfo = process.env.uniTestPlatformInfo.toLowerCase()
const isAndroid = platformInfo.startsWith('android') const isAndroid = platformInfo.startsWith('android')
const isIOS = platformInfo.startsWith('ios') const isIOS = platformInfo.startsWith('ios')
const isMP = platformInfo.startsWith('mp') const isMP = platformInfo.startsWith('mp')
const isHarmony = platformInfo.includes('harmony') const isHarmony = platformInfo.includes('harmony')
let page let page
...@@ -31,7 +31,7 @@ describe('v-on', () => { ...@@ -31,7 +31,7 @@ describe('v-on', () => {
await onceBtn.tap() await onceBtn.tap()
expect(await count.text()).toBe(supportedCount) expect(await count.text()).toBe(supportedCount)
} }
if (isAndroid || isIOS || isHarmony) { if (isAndroid || isIOS) {
const btnPreventRect = (await page.data('btnPreventRect')).value const btnPreventRect = (await page.data('btnPreventRect')).value
const x = Math.ceil(btnPreventRect.x + btnPreventRect.width / 2) const x = Math.ceil(btnPreventRect.x + btnPreventRect.width / 2)
const y = Math.ceil(btnPreventRect.y + btnPreventRect.height / 2.0) const y = Math.ceil(btnPreventRect.y + btnPreventRect.height / 2.0)
......
...@@ -86,7 +86,7 @@ describe('component-lifecycle', () => { ...@@ -86,7 +86,7 @@ describe('component-lifecycle', () => {
await page.waitFor('view') await page.waitFor('view')
lifeCycleNum = await page.callMethod('getLifeCycleNum') lifeCycleNum = await page.callMethod('getLifeCycleNum')
// App 端页面离开返回不触发 keepAlive 组件 activated deactivated, 详见 https://issues.dcloud.net.cn/pages/issues/detail?id=7419 // App 端页面离开返回不触发 keepAlive 组件 activated deactivated, 详见 https://issues.dcloud.net.cn/pages/issues/detail?id=7419
expect(lifeCycleNum).toBe(isIOS || isAndroid ? -10 : -11) expect(lifeCycleNum).toBe((isIOS || isAndroid || isHarmony) ? -10 : -11)
page = await program.navigateBack() page = await program.navigateBack()
await page.waitFor('view') await page.waitFor('view')
lifeCycleNum = await page.callMethod('pageGetLifeCycleNum') lifeCycleNum = await page.callMethod('pageGetLifeCycleNum')
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册