提交 d4421ea0 编写于 作者: Y yurj26

feat(uts-tests): add uvue

上级 95351b46
...@@ -28,6 +28,8 @@ ...@@ -28,6 +28,8 @@
</uni-list-item> </uni-list-item>
<uni-list-item @tap="testConsole" title="日志打印示例" :clickable="true" link> <uni-list-item @tap="testConsole" title="日志打印示例" :clickable="true" link>
</uni-list-item> </uni-list-item>
<uni-list-item @tap="testGrammar" title="基础语法测试例" :clickable="true" link>
</uni-list-item>
</uni-list> </uni-list>
</uni-collapse-item> </uni-collapse-item>
<uni-collapse-item title="资源加载示例" :border="false"> <uni-collapse-item title="资源加载示例" :border="false">
...@@ -198,6 +200,11 @@ ...@@ -198,6 +200,11 @@
url: '/pages/SyntaxCase/consoleTest' url: '/pages/SyntaxCase/consoleTest'
}) })
}, },
testGrammar: function() {
uni.navigateTo({
url: '/pages/test/index'
})
},
testGetResourcePath: function() { testGetResourcePath: function() {
uni.navigateTo({ uni.navigateTo({
url: '/pages/advance/iOS/getResourcePath' url: '/pages/advance/iOS/getResourcePath'
......
...@@ -6,8 +6,8 @@ beforeAll(async () => { ...@@ -6,8 +6,8 @@ beforeAll(async () => {
await program.reLaunch('/pages/test/index') await program.reLaunch('/pages/test/index')
page = await program.currentPage() page = await program.currentPage()
await page.waitFor(3000); await page.waitFor(3000);
const data = await page.data('result'); const data = await page.data();
result = data result = data['result']
}) })
function getApiFailed(describe, api) { function getApiFailed(describe, api) {
......
<template>
<view class="content">
<view v-for="(item,index) in resultArray" :key="index" class="result">
<view>{{names[index]}}测试结果:</view>
<view>
测试api:{{item.passed.join(', ')}}
</view>
<view>总共:{{item.total}}</view>
<view>通过:{{item.passed.length}}</view>
<view>失败:{{item.failed.length}}</view>
<view v-for="(fail,i) in item.failed" :key="i">
<text class="failed">{{fail}}</text>
</view>
</view>
</view>
</template>
<script lang="ts">
import {
runTests,
Result
} from '../../uni_modules/uts-tests'
export default {
data() {
return {
resultArray: [] as Result[],
result: {} as UTSJSONObject,
names: [] as string[]
}
},
onReady() {
this.test()
},
methods: {
test() {
this.result = runTests()
const resultMap = this.result.toMap()
resultMap.forEach((res, name) => {
this.names.push(name)
this.resultArray.push(res as Result)
})
}
}
}
</script>
<style>
.content {
padding: 32rpx;
}
.passed {
color: green;
}
.failed {
color: red;
}
.result {
margin-bottom: 20rpx;
}
</style>
\ No newline at end of file
...@@ -13,7 +13,7 @@ import { testRegExp } from './RegExp.uts' ...@@ -13,7 +13,7 @@ import { testRegExp } from './RegExp.uts'
// import { testReactiveArray } from './reactiveArray.uts' // import { testReactiveArray } from './reactiveArray.uts'
// import { testReactiveMap } from './ReactiveMap.uts' // import { testReactiveMap } from './ReactiveMap.uts'
// #endif // #endif
// export { Result } from './tests.uts' export { Result } from './tests.uts'
// Promise、Proxy、Reflect、Weakmap、WeakSet 不支持 // Promise、Proxy、Reflect、Weakmap、WeakSet 不支持
export function runTests() : UTSJSONObject { export function runTests() : UTSJSONObject {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册