提交 82d71415 编写于 作者: M mahaifeng

[open-type]添加测试用例与示例

上级 eb3e2f38
...@@ -205,6 +205,15 @@ ...@@ -205,6 +205,15 @@
"navigationBarTitleText": "textarea | 多行输入框" "navigationBarTitleText": "textarea | 多行输入框"
} }
}, },
// #ifdef APP-ANDROID
{
"path": "pages/component/open-type/open-type",
"group": "0,3,12",
"style": {
"navigationBarTitleText": "button | open-type"
}
},
//#endif
{ {
"path": "pages/component/slider/slider", "path": "pages/component/slider/slider",
"group": "0,3,9", "group": "0,3,9",
...@@ -2053,7 +2062,11 @@ ...@@ -2053,7 +2062,11 @@
{ {
"id": "component.form-component.textarea", "id": "component.form-component.textarea",
"name": "textarea" "name": "textarea"
} },
{
"id": "component.form-component.open-type",
"name": "open-type"
}
] ]
}, },
{ {
......
let page;
describe('open-type', () => {
beforeAll(async () => {
page = await program.reLaunch('/pages/component/open-type/open-type')
await page.waitFor(600);
});
it('opentype-test', async () => {
if (!isAndroid()) {
return
}
const opentype = await page.$('#opentype')
await opentype.tap()
let isAgreeRes = await getData('isAgreeRes')
expect(isAgreeRes).toBe(true)
})
function isAndroid() {
if (process.env.uniTestPlatformInfo.indexOf('web') > -1 || process.env.UNI_AUTOMATOR_APP_WEBVIEW ===
'true') {
expect(1).toBe(1)
return false
}
if (process.env.uniTestPlatformInfo.toLocaleLowerCase().startsWith('ios')) {
expect(1).toBe(1)
return false
}
return true
}
function getData(key = '') {
return new Promise(async (resolve, reject) => {
const data = await page.data()
resolve(key ? data[key] : data)
})
}
});
<template>
<!-- #ifdef APP -->
<scroll-view style="flex:1">
<!-- #endif -->
<button id="opentype" style="margin: 12px;" type="primary" open-type="agreePrivacyAuthorization" @click="agree">agreePrivacyAuthorization</button>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
</template>
<script>
export default {
data() {
return {
isAgreeRes: false,
log: "",
}
},
methods: {
agree() {
// #ifdef APP-ANDROID
let res = UTSAndroid.isPrivacyAgree()
this.isAgreeRes = res
uni.showToast({
title:'isPrivacyAgree:'+res
})
// #endif
}
}
}
</script>
<style>
</style>
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册