Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
0788cc70
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
350
Star
2
Fork
7
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
1
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello-uvue
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
1
Issue
1
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
0788cc70
编写于
1月 24, 2024
作者:
雪洛
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
feat: 调整测试例兼容web端
上级
96b113f9
变更
18
显示空白变更内容
内联
并排
Showing
18 changed file
with
233 addition
and
167 deletion
+233
-167
pages.json
pages.json
+3
-1
pages/component-instance/methods/call-method-easycom.uvue
pages/component-instance/methods/call-method-easycom.uvue
+8
-8
pages/component-instance/methods/call-method-uni-element.uvue
...s/component-instance/methods/call-method-uni-element.uvue
+5
-5
pages/component-instance/root/root.test.js
pages/component-instance/root/root.test.js
+7
-0
pages/component-instance/root/root.uvue
pages/component-instance/root/root.uvue
+3
-0
pages/composition-api/dependency-injection/provide/provide-inject.test.js
...n-api/dependency-injection/provide/provide-inject.test.js
+3
-2
pages/composition-api/reactivity/effect-scope/effect-scope.test.js
...position-api/reactivity/effect-scope/effect-scope.test.js
+2
-1
pages/composition-api/reactivity/readonly/readonly.test.js
pages/composition-api/reactivity/readonly/readonly.test.js
+8
-7
pages/composition-api/reactivity/to-ref/to-ref.test.js
pages/composition-api/reactivity/to-ref/to-ref.test.js
+7
-0
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js
...pi/reactivity/watch-post-effect/watch-post-effect.test.js
+13
-5
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.uvue
...n-api/reactivity/watch-post-effect/watch-post-effect.uvue
+1
-2
pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js
...pi/reactivity/watch-sync-effect/watch-sync-effect.test.js
+6
-2
pages/composition/mixins/mixins.test.js
pages/composition/mixins/mixins.test.js
+1
-1
pages/composition/setup/setup.test.js
pages/composition/setup/setup.test.js
+81
-72
pages/composition/setup/setup.uvue
pages/composition/setup/setup.uvue
+66
-60
pages/directive/v-model/v-model.test.js
pages/directive/v-model/v-model.test.js
+9
-1
pages/tab-bar/composition-api.uvue
pages/tab-bar/composition-api.uvue
+5
-0
pages/tab-bar/options-api.uvue
pages/tab-bar/options-api.uvue
+5
-0
未找到文件。
pages.json
浏览文件 @
0788cc70
...
...
@@ -183,6 +183,7 @@
"navigationBarTitleText"
:
"$options"
}
},
//
#ifdef
APP
{
"path"
:
"pages/component-instance/parent/parent"
,
"style"
:
{
...
...
@@ -195,6 +196,7 @@
"navigationBarTitleText"
:
"$root"
}
},
//
#endif
{
"path"
:
"pages/component-instance/slots/slots"
,
"style"
:
{
...
...
@@ -506,13 +508,13 @@
"navigationBarTitleText"
:
"toValue"
}
},
//
#endif
{
"path"
:
"pages/composition-api/reactivity/to-refs/to-refs"
,
"style"
:
{
"navigationBarTitleText"
:
"toRefs"
}
},
//
#endif
{
"path"
:
"pages/composition-api/reactivity/is-proxy/is-proxy"
,
"style"
:
{
...
...
pages/component-instance/methods/call-method-easycom.uvue
浏览文件 @
0788cc70
...
...
@@ -8,39 +8,39 @@
export default {
data() {
return {
$
callEasyMethod1: null as CallEasyMethodComponentPublicInstance | null
callEasyMethod1: null as CallEasyMethodComponentPublicInstance | null
}
},
onReady() {
// 通过组件 ref 属性获取组件实例, 组件标签名首字母大写,驼峰+ComponentPublicInstance
this.
$
callEasyMethod1 = this.$refs['callEasyMethod1'] as CallEasyMethodComponentPublicInstance;
this.callEasyMethod1 = this.$refs['callEasyMethod1'] as CallEasyMethodComponentPublicInstance;
},
methods: {
callMethod1() {
// 调用组件的 foo1 方法
this.
$
callEasyMethod1!.foo1();
this.callEasyMethod1!.foo1();
},
callMethod2() {
// 调用组件的 foo2 方法并传递 1个参数
this.
$
callEasyMethod1!.foo2(Date.now());
this.callEasyMethod1!.foo2(Date.now());
},
callMethod3() {
// 调用组件的 foo3 方法并传递 2个参数
this.
$
callEasyMethod1!.foo3(Date.now(), Date.now());
this.callEasyMethod1!.foo3(Date.now(), Date.now());
},
callMethod4() {
// 调用组件的 foo4 方法并传递 callback
this.
$
callEasyMethod1!.foo4(() => {
this.callEasyMethod1!.foo4(() => {
console.log('callback')
});
},
callMethod5() {
// 注意: 返回值可能为 null,当前例子一定不为空,所以加了 !
const result = this.
$
callEasyMethod1!.foo5('string1') as string;
const result = this.callEasyMethod1!.foo5('string1') as string;
console.log(result); // string1
},
callMethodTest(text: string): string | null {
const result = this.
$
callEasyMethod1!.foo5(text) as string;
const result = this.callEasyMethod1!.foo5(text) as string;
return result;
},
}
...
...
pages/component-instance/methods/call-method-uni-element.uvue
浏览文件 @
0788cc70
...
...
@@ -8,22 +8,22 @@
export default {
data() {
return {
$
slider1: null as UniSliderElement | null
slider1: null as UniSliderElement | null
}
},
onReady() {
// 通过组件 ref 属性获取组件实例, Uni组件名(驼峰)UniElement
this.
$
slider1 = this.$refs['slider1'] as UniSliderElement;
this.slider1 = this.$refs['slider1'] as UniSliderElement;
},
methods: {
setValue() : boolean {
// 设置组件的 value 属性
this.
$
slider1!.value = 80;
this.slider1!.value = 80;
return true;
},
callMethodTest(text: string): string | null {
this.
$slider1!.setAttribute('value
', text);
const result = this.
$slider1!.getAttribute('value
') as string;
this.
slider1!.setAttribute('str
', text);
const result = this.
slider1!.getAttribute('str
') as string;
return result;
},
}
...
...
pages/component-instance/root/root.test.js
浏览文件 @
0788cc70
const
PAGE_PATH
=
'
/pages/component-instance/root/root
'
describe
(
'
$root
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: web 端$root指向和app端不同,具体待定
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
pages/component-instance/root/root.uvue
浏览文件 @
0788cc70
...
...
@@ -11,6 +11,9 @@ export default {
root: true
}
},
onReady() {
console.log(this.getRoot())
},
methods: {
getRoot (): boolean {
return this.$root!.$data['root'] as boolean
...
...
pages/composition-api/dependency-injection/provide/provide-inject.test.js
浏览文件 @
0788cc70
const
PAGE_PATH
=
'
/pages/composition-api/dependency-injection/provide/provide
'
describe
(
'
provide-inject-hasInjectionContext
'
,
()
=>
{
const
isWeb
=
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -14,11 +15,11 @@ describe('provide-inject-hasInjectionContext', () => {
expect
(
await
num
.
text
()).
toBe
(
'
num: 0
'
)
const
obj
=
await
page
.
$
(
'
.obj
'
)
expect
(
await
obj
.
text
()).
toBe
(
'
obj: {"a":1}
'
)
expect
(
await
obj
.
text
()).
toBe
(
isWeb
?
'
obj: {
\n
"a": 1
\n
}
'
:
'
obj: {"a":1}
'
)
const
arr
=
await
page
.
$
(
'
.arr
'
)
expect
(
await
arr
.
text
()).
toBe
(
'
arr: [1,2,3]
'
)
expect
(
await
arr
.
text
()).
toBe
(
isWeb
?
'
arr: [
\n
1,
\n
2,
\n
3
\n
]
'
:
'
arr: [1,2,3]
'
)
const
fn
=
await
page
.
$
(
'
.fn
'
)
expect
(
await
fn
.
text
()).
toBe
(
'
fn: hello
'
)
...
...
pages/composition-api/reactivity/effect-scope/effect-scope.test.js
浏览文件 @
0788cc70
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/effect-scope/effect-scope
'
describe
(
'
effectScope
'
,
()
=>
{
const
isWeb
=
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -11,7 +12,7 @@ describe('effectScope', () => {
expect
(
await
counter
.
text
()).
toBe
(
'
counter: 0
'
)
const
watchCounterRes
=
await
page
.
$
(
'
#watch-counter-res
'
)
expect
(
await
watchCounterRes
.
text
()).
toBe
(
'
watch counter result:
'
)
expect
(
await
watchCounterRes
.
text
()).
toBe
(
isWeb
?
'
watch counter result:
'
:
'
watch counter result:
'
)
const
watchEffectCounterRes
=
await
page
.
$
(
'
#watch-effect-counter-res
'
)
expect
(
await
watchEffectCounterRes
.
text
()).
toBe
(
'
watchEffect counter result: counter: 0
'
)
...
...
pages/composition-api/reactivity/readonly/readonly.test.js
浏览文件 @
0788cc70
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/readonly/readonly
'
describe
(
'
ref
'
,
()
=>
{
const
isWeb
=
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -12,33 +13,33 @@ describe('ref', () => {
const
dataNum
=
await
page
.
$
(
'
#data-num
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
data.num: 0
'
)
const
dataArr
=
await
page
.
$
(
'
#data-arr
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
'
data.arr: ["a","b","c"]
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
isWeb
?
'
data.arr: [
\n
"a",
\n
"b",
\n
"c"
\n
]
'
:
'
data.arr: ["a","b","c"]
'
)
const
readonlyDataStr
=
await
page
.
$
(
'
#readonly-data-str
'
)
expect
(
await
readonlyDataStr
.
text
()).
toBe
(
'
readonly data.str: default str
'
)
const
readonlyDataNum
=
await
page
.
$
(
'
#readonly-data-num
'
)
expect
(
await
readonlyDataNum
.
text
()).
toBe
(
'
readonly data.num: 0
'
)
const
readonlyDataArr
=
await
page
.
$
(
'
#readonly-data-arr
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
'
readonly data.arr: ["a","b","c"]
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
isWeb
?
'
readonly data.arr: [
\n
"a",
\n
"b",
\n
"c"
\n
]
'
:
'
readonly data.arr: ["a","b","c"]
'
)
const
updateDataBtn
=
await
page
.
$
(
'
#update-data-btn
'
)
await
updateDataBtn
.
tap
()
expect
(
await
dataStr
.
text
()).
toBe
(
'
data.str: new str
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
data.num: 1
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
'
data.arr: ["a","b","c","d"]
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
isWeb
?
'
data.arr: [
\n
"a",
\n
"b",
\n
"c",
\n
"d"
\n
]
'
:
'
data.arr: ["a","b","c","d"]
'
)
expect
(
await
readonlyDataStr
.
text
()).
toBe
(
'
readonly data.str: new str
'
)
expect
(
await
readonlyDataNum
.
text
()).
toBe
(
'
readonly data.num: 1
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
'
readonly data.arr: ["a","b","c","d"]
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
isWeb
?
'
readonly data.arr: [
\n
"a",
\n
"b",
\n
"c",
\n
"d"
\n
]
'
:
'
readonly data.arr: ["a","b","c","d"]
'
)
const
updateReadonlyDataBtn
=
await
page
.
$
(
'
#update-readonly-data-btn
'
)
await
updateReadonlyDataBtn
.
tap
()
expect
(
await
dataStr
.
text
()).
toBe
(
'
data.str: new str
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
data.num: 1
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
'
data.arr: ["a","b","c","d"]
'
)
expect
(
await
dataArr
.
text
()).
toBe
(
isWeb
?
'
data.arr: [
\n
"a",
\n
"b",
\n
"c",
\n
"d"]
'
:
'
data.arr: ["a","b","c","d"]
'
)
expect
(
await
readonlyDataStr
.
text
()).
toBe
(
'
readonly data.str: new str
'
)
expect
(
await
readonlyDataNum
.
text
()).
toBe
(
'
readonly data.num: 1
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
'
readonly data.arr: ["a","b","c","d"]
'
)
expect
(
await
readonlyDataArr
.
text
()).
toBe
(
isWeb
?
'
readonly data.arr: [
\n
"a",
\n
"b",
\n
"c",
\n
"d"
\n
]
'
:
'
readonly data.arr: ["a","b","c","d"]
'
)
})
})
\ No newline at end of file
pages/composition-api/reactivity/to-ref/to-ref.test.js
浏览文件 @
0788cc70
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/to-ref/to-ref
'
describe
(
'
toRef
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.test.js
浏览文件 @
0788cc70
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/watch-post-effect/watch-post-effect
'
describe
(
'
watchPostEffect
'
,
()
=>
{
const
isWeb
=
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -23,7 +24,9 @@ describe('watchPostEffect', () => {
const
watchCountTriggerNum
=
await
page
.
$
(
'
#watch-count-trigger-num
'
)
expect
(
await
watchCountTriggerNum
.
text
()).
toBe
(
'
watch count trigger number: 0
'
)
const
watchCountCleanupRes
=
await
page
.
$
(
'
#watch-count-cleanup-res
'
)
expect
(
await
watchCountCleanupRes
.
text
()).
toBe
(
'
watch count cleanup result:
'
)
// TODO web端自动化测试text方法应使用textContent获取内容来保留空格,目前text方法未保留首尾空格
expect
(
await
watchCountCleanupRes
.
text
()).
toBe
(
isWeb
?
'
watch count cleanup result:
'
:
'
watch count cleanup result:
'
)
// watch count and obj.num
const
watchCountAndObjNumRes
=
await
page
.
$
(
'
#watch-count-obj-num-res
'
)
...
...
@@ -75,11 +78,15 @@ describe('watchPostEffect', () => {
const
objBool
=
await
page
.
$
(
'
#obj-bool
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: false
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0
\n
]
'
:
'
obj.arr: [0]
'
)
const
watchObjRes
=
await
page
.
$
(
'
#watch-obj-res
'
)
// TODO web端和安卓端JSON.stringify对属性的排序不一致
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
isWeb
?
'
watch obj result: obj: {"num":0,"str":"num: 0","bool":false,"arr":[0]}
'
:
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
const
watchObjStrRes
=
await
page
.
$
(
'
#watch-obj-str-res
'
)
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
'
watch obj.str result: str: num: 0, obj.str ref text: obj.str: num: 0
'
)
...
...
@@ -92,13 +99,14 @@ describe('watchPostEffect', () => {
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: num: 1
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 1
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0,1]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0,
\n
1
\n
]
'
:
'
obj.arr: [0,1]
'
)
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
'
watch obj.str result: str: num: 1, obj.str ref text: obj.str: num: 1
'
)
expect
(
await
watchObjArrRes
.
text
()).
toBe
(
'
watch obj.arr result: arr: [0,1]
'
)
expect
(
await
watchObjArrRes
.
text
()).
toBe
(
isWeb
?
'
watch obj.arr result: arr: [
\n
0,
\n
1
\n
]
'
:
'
watch obj.arr result: arr: [0,1]
'
)
const
watchCountAndObjNumRes
=
await
page
.
$
(
'
#watch-count-obj-num-res
'
)
expect
(
await
watchCountAndObjNumRes
.
text
()).
toBe
(
'
watch count and obj.num result: count: 3, obj.num: 1
'
)
...
...
pages/composition-api/reactivity/watch-post-effect/watch-post-effect.uvue
浏览文件 @
0788cc70
...
...
@@ -8,8 +8,7 @@
<text id="watch-count-track-num" class="uni-common-mb">watch count track number: {{ watchCountTrackNum }}</text>
<text id="watch-count-trigger-num" class="uni-common-mb">watch count trigger number:
{{ watchCountTriggerNum }}</text>
<text id="watch-count-cleanup-res" class="uni-common-mb">watch count cleanup result:
{{ watchCountCleanupRes }}</text>
<text id="watch-count-cleanup-res" class="uni-common-mb">watch count cleanup result: {{ watchCountCleanupRes }}</text>
<button id="increment-btn" class="uni-common-mb" @click="increment">
increment
</button>
...
...
pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect.test.js
浏览文件 @
0788cc70
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/watch-sync-effect/watch-sync-effect
'
describe
(
'
watchSyncEffect
'
,
()
=>
{
const
isWeb
=
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -75,11 +76,14 @@ describe('watchSyncEffect', () => {
const
objBool
=
await
page
.
$
(
'
#obj-bool
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: false
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [0]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isWeb
?
'
obj.arr: [
\n
0
\n
]
'
:
'
obj.arr: [0]
'
)
const
watchObjRes
=
await
page
.
$
(
'
#watch-obj-res
'
)
expect
(
await
watchObjRes
.
text
()).
toBe
(
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
isWeb
?
'
watch obj result: obj: {"num":0,"str":"num: 0","bool":false,"arr":[0]}
'
:
'
watch obj result: obj: {"arr":[0],"bool":false,"num":0,"str":"num: 0"}
'
)
const
watchObjStrRes
=
await
page
.
$
(
'
#watch-obj-str-res
'
)
expect
(
await
watchObjStrRes
.
text
()).
toBe
(
'
watch obj.str result: str: num: 0, obj.str ref text: obj.str: num: 0
'
)
...
...
pages/composition/mixins/mixins.test.js
浏览文件 @
0788cc70
...
...
@@ -2,7 +2,7 @@ const PAGE_PATH = '/pages/composition/mixins/mixins'
let
page
describe
(
'
mixins
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: web 端暂不支持
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
...
...
pages/composition/setup/setup.test.js
浏览文件 @
0788cc70
// TODO web端
const
PAGE_PATH
=
'
/pages/composition/setup/setup
'
describe
(
'
options setup
'
,
()
=>
{
let
page
...
...
@@ -23,6 +25,7 @@ describe('options setup', () => {
const
objBool
=
await
page
.
$
(
'
#obj-bool
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: false
'
)
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
const
propsStr
=
await
page
.
$
(
'
#props-str
'
)
expect
(
await
propsStr
.
text
()).
toBe
(
'
props.str: default str
'
)
const
propsCount
=
await
page
.
$
(
'
#props-count
'
)
...
...
@@ -33,6 +36,7 @@ describe('options setup', () => {
expect
(
await
propsObjNum
.
text
()).
toBe
(
`props.obj['num']: 0`
)
const
propsObjBool
=
await
page
.
$
(
'
#props-obj-bool
'
)
expect
(
await
propsObjBool
.
text
()).
toBe
(
`props.obj['bool']: false`
)
}
})
it
(
'
props
'
,
async
()
=>
{
const
incrementBtn
=
await
page
.
$
(
'
#increment-btn
'
)
...
...
@@ -53,17 +57,21 @@ describe('options setup', () => {
const
objBool
=
await
page
.
$
(
'
#obj-bool
'
)
expect
(
await
objBool
.
text
()).
toBe
(
'
obj.bool: true
'
)
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
const
propsObjStr
=
await
page
.
$
(
'
#props-obj-str
'
)
expect
(
await
propsObjStr
.
text
()).
toBe
(
`props.obj['str']: obj new str`
)
const
propsObjNum
=
await
page
.
$
(
'
#props-obj-num
'
)
expect
(
await
propsObjNum
.
text
()).
toBe
(
`props.obj['num']: 100`
)
const
propsObjBool
=
await
page
.
$
(
'
#props-obj-bool
'
)
expect
(
await
propsObjBool
.
text
()).
toBe
(
`props.obj['bool']: true`
)
}
})
it
(
'
context
'
,
async
()
=>
{
if
(
!
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// attrs
const
contextAttrsIsShow
=
await
page
.
$
(
'
#context-attrs-is-show
'
)
expect
(
await
contextAttrsIsShow
.
text
()).
toBe
(
'
context.attrs.isShow: true
'
)
// emits
const
compUpdateObjBtn
=
await
page
.
$
(
'
#comp-update-obj-btn
'
)
await
compUpdateObjBtn
.
tap
()
...
...
@@ -73,6 +81,7 @@ describe('options setup', () => {
expect
(
await
propsObjNum
.
text
()).
toBe
(
`props.obj['num']: 200`
)
const
propsObjBool
=
await
page
.
$
(
'
#props-obj-bool
'
)
expect
(
await
propsObjBool
.
text
()).
toBe
(
`props.obj['bool']: true`
)
}
// slots
const
defaultSlotInFoo
=
await
page
.
$
(
'
#default-slot-in-foo
'
)
expect
(
await
defaultSlotInFoo
.
text
()).
toBe
(
'
default slot in Foo
'
)
...
...
pages/composition/setup/setup.uvue
浏览文件 @
0788cc70
...
...
@@ -12,7 +12,9 @@
<text class='uni-common-mt' id="obj-num">obj.num: {{ obj['num'] }}</text>
<text class='uni-common-mt' id="obj-bool">obj.bool: {{ obj['bool'] }}</text>
<button class='uni-common-mt' id="update-obj-btn" @click="updateObj">update obj</button>
<!-- #ifdef APP -->
<RenderFunction :str='str' :count='count' :obj='obj' @compUpdateObj='compUpdateObj' :isShow='true' />
<!-- #endif -->
<Foo>
<text class="uni-common-mt" id="default-slot-in-foo">default slot in Foo</text>
</Foo>
...
...
@@ -23,11 +25,15 @@
</template>
<script>
// #ifdef APP
import RenderFunction from './RenderFunction.uvue'
// #endif
import Foo from './Foo.uvue'
export default {
components: {
// #ifdef APP
RenderFunction,
// #endif
Foo
},
setup() {
...
...
pages/directive/v-model/v-model.test.js
浏览文件 @
0788cc70
const
PAGE_PATH
=
'
/pages/directive/v-model/v-model
'
describe
(
'
v-model
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
// TODO: web 自动化测试InputElement input方法报错
it
(
'
web
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
return
}
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
})
it
(
'
input
'
,
async
()
=>
{
const
value
=
Date
.
now
()
+
''
...
...
pages/tab-bar/composition-api.uvue
浏览文件 @
0788cc70
...
...
@@ -166,7 +166,12 @@
{
name: 'toRefs',
url: 'to-refs',
// #ifdef APP
enable: true,
// #endif
// #ifdef WEB
enable: false,
// #endif
},
{
name: 'isProxy',
...
...
pages/tab-bar/options-api.uvue
浏览文件 @
0788cc70
...
...
@@ -312,7 +312,12 @@
{
name: '$root',
url: 'root',
// #ifdef APP
enable: true,
// #endif
// #ifdef WEB
enable: false,
// #endif
},
{
name: '$slots',
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录