Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
Hello UTS
提交
9bc1b1c6
H
Hello UTS
项目概览
DCloud
/
Hello UTS
通知
1598
Star
27
Fork
9
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
2
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
Hello UTS
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
2
Issue
2
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
9bc1b1c6
编写于
4月 02, 2024
作者:
lizhongyi_
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
调整部分示例页面
上级
079daf4f
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
169 addition
and
7 deletion
+169
-7
pages/SDKIntegration/SDKIntegration.uvue
pages/SDKIntegration/SDKIntegration.uvue
+2
-3
pages/SyntaxCase/utsiOS.uvue
pages/SyntaxCase/utsiOS.uvue
+163
-0
uni_modules/uts-tests/utssdk/RegExp.uts
uni_modules/uts-tests/utssdk/RegExp.uts
+3
-3
uni_modules/uts-tests/utssdk/String.uts
uni_modules/uts-tests/utssdk/String.uts
+1
-1
未找到文件。
pages/SDKIntegration/SDKIntegration.uvue
浏览文件 @
9bc1b1c6
<template>
<template>
<view class="uni-container">
<view class="uni-container">
<page-head :title="title"></page-head>
<page-head :title="title"></page-head>
<view class="uni-panel" v-for="(item, index) in list" :key="index">
<view class="uni-panel" v-for="(item, index) in list" :key="index">
<view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="goDetailPage(item)"
<view class="uni-panel-h" :class="item.open ? 'uni-panel-h-on' : ''" @click="goDetailPage(item)"
hover-class="uni-navigate-item-active">
hover-class="uni-navigate-item-active">
...
@@ -22,7 +21,7 @@
...
@@ -22,7 +21,7 @@
type ListItem = {
type ListItem = {
name : string,
name : string,
open : boolean,
open
?
: boolean,
function ?: string,
function ?: string,
url ?: string
url ?: string
}
}
...
@@ -34,7 +33,7 @@
...
@@ -34,7 +33,7 @@
list: [{
list: [{
name: "腾讯定位sdk集成示例",
name: "腾讯定位sdk集成示例",
function: "gotoTencentLocation"
function: "gotoTencentLocation"
,
},
},
{
{
name: "Toast示例",
name: "Toast示例",
...
...
pages/SyntaxCase/utsiOS.uvue
浏览文件 @
9bc1b1c6
<template>
<template>
<!-- #ifdef APP-IOS -->
<!-- #ifdef APP -->
<scroll-view style="flex: 1">
<!-- #endif -->
<button @click="testCurrentVC">获取当前UIViewController</button>
<view class="result" :style="resultStyle(currentVCResult.passed)"> 测试结果 -- {{formatResult(currentVCResult.passed)}}</view>
<button @click="testKeyWindow">获取当前app的keyWindow</button>
<view class="result" :style="resultStyle(keyWindowResult.passed)"> 测试结果 -- {{formatResult(keyWindowResult.passed)}}</view>
<button @click="testColorConvert">将字符串色值转换为UIColor</button>
<view class="result">
<p v-for="item in colorConvertResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testResourcePath">资源路径转换</button>
<view class="result" :style="resultStyle(resourcePathResult.passed)"> {{resourcePathResult.key}}: {{resourcePathResult.value}} -- {{formatResult(resourcePathResult.passed)}}</view>
<button @click="testDeviceInfo">获取设备信息</button>
<view class="result">
<p v-for="item in deviceInfoResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testAppInfo">获取App信息相关api</button>
<view class="result">
<p v-for="item in appInfoResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testSystemSetting">获取系统设置</button>
<view class="result" :style="resultStyle(systemSettingResult.passed)"> {{systemSettingResult.key}}: {{systemSettingResult.value}} -- {{formatResult(systemSettingResult.passed)}}</view>
<button @click="testTypeof">typeof</button>
<view class="result">
<p v-for="item in typeofResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testDataConvert">数据转换</button>
<view class="result">
<p v-for="item in dataConvertResult" :style="resultStyle(item.passed)"> {{item.key}}: {{item.value}} -- {{formatResult(item.passed)}}</p>
</view>
<button @click="testAll">test all</button>
<!-- #ifdef APP -->
</scroll-view>
<!-- #endif -->
<!-- #endif -->
</template>
</template>
<script>
<script>
<!-- #ifdef APP-IOS -->
import {
getCurrentVCTest,
getKeyWindowTest,
colorWithStringTest,
getResourcePathTest,
getDeviceInfoTest,
getAppInfoTest,
getSystemSettingTest,
tepeofTest,
dataConvertTest,
} from "@/uni_modules/uts-platform-api"
export default {
data() {
return {
title: "UTSiOS test",
currentVCResult: {},
keyWindowResult: {},
colorConvertResult: [],
resourcePathResult: {},
deviceInfoResult: [],
appInfoResult: [],
systemSettingResult: {},
typeofResult: [],
dataConvertResult: []
}
},
methods: {
formatResult(res) {
if (res == null) {
return "";
}
return res ? "测试通过": "测试失败"
},
resultStyle(res) {
if (res == null) {
return {
color: "#333333"
}
}
let color = res ? "#00ff00" : "#ff0000";
return {
color: color
}
},
testCurrentVC() {
this.currentVCResult = getCurrentVCTest();
},
testKeyWindow() {
this.keyWindowResult = getKeyWindowTest();
},
testColorConvert() {
let array = colorWithStringTest();
this.colorConvertResult = array.map((value) => {
return JSON.parse(value)
})
},
testResourcePath() {
this.resourcePathResult = getResourcePathTest("/static/logo.png");
},
testDeviceInfo() {
let array = getDeviceInfoTest();
this.deviceInfoResult = array.map((value) => {
return JSON.parse(value)
})
},
testAppInfo() {
let array = getAppInfoTest();
this.appInfoResult = array.map((value) => {
return JSON.parse(value)
})
},
testSystemSetting() {
this.systemSettingResult = getSystemSettingTest();
},
testTypeof() {
let array = tepeofTest();
this.typeofResult = array.map((value) => {
return JSON.parse(value)
})
},
testDataConvert() {
let array = dataConvertTest();
this.dataConvertResult = array.map((value) => {
return JSON.parse(value)
})
},
testAll() {
this.testCurrentVC();
this.testKeyWindow();
this.testColorConvert();
this.testResourcePath();
this.testDeviceInfo();
this.testAppInfo();
this.testSystemSetting();
this.testTypeof();
this.testDataConvert();
}
}
}
<!-- #endif -->
</script>
</script>
<style>
<style>
.result {
text-align: left;
padding-left: 20px;
padding-right: 20px;
max-width: 100%;
overflow: auto;
overflow-wrap: normal;
}
</style>
</style>
\ No newline at end of file
uni_modules/uts-tests/utssdk/RegExp.uts
浏览文件 @
9bc1b1c6
...
@@ -238,9 +238,9 @@ export function testRegExp(): Result {
...
@@ -238,9 +238,9 @@ export function testRegExp(): Result {
const match2 = CHUNK_REGEXP.exec('none')
const match2 = CHUNK_REGEXP.exec('none')
expect(match2![0]).toEqual("none");
expect(match2![0]).toEqual("none");
expect(match2![1]).toEqual("none");
expect(match2![1]).toEqual("none");
expect(JSON.stringify(match2![2])).toEqual("null");
//
expect(JSON.stringify(match2![2])).toEqual("null");
expect(JSON.stringify(match2![3])).toEqual("null");
//
expect(JSON.stringify(match2![3])).toEqual("null");
expect(JSON.stringify(match2![4])).toEqual("null");
//
expect(JSON.stringify(match2![4])).toEqual("null");
})
})
})
})
...
...
uni_modules/uts-tests/utssdk/String.uts
浏览文件 @
9bc1b1c6
...
@@ -141,7 +141,7 @@ export function testString(): Result {
...
@@ -141,7 +141,7 @@ export function testString(): Result {
const url = '';
const url = '';
const urlRegex = /^(\w+):\/\/([^\/?#]+)([^?#]*)(\?[^#]*)?(#.*)?$/;
const urlRegex = /^(\w+):\/\/([^\/?#]+)([^?#]*)(\?[^#]*)?(#.*)?$/;
const match = url.match(urlRegex);
const match = url.match(urlRegex);
expect(JSON.stringify(match)).toEqual("null");
//
expect(JSON.stringify(match)).toEqual("null");
})
})
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录