Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
1652db87
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
401
Star
3
Fork
10
代码
文件
提交
分支
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看板
提交
1652db87
编写于
5月 06, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
refactor: 重构 built in 目录并修复测试
上级
d4632f07
变更
32
隐藏空白更改
内联
并排
Showing
32 changed file
with
254 addition
and
219 deletion
+254
-219
pages.json
pages.json
+38
-39
pages/app-instance/globalProperties/globalProperties.test.js
pages/app-instance/globalProperties/globalProperties.test.js
+8
-8
pages/built-in/component/keep-alive/keep-alive.test.js
pages/built-in/component/keep-alive/keep-alive.test.js
+2
-2
pages/built-in/component/teleport/teleport.test.js
pages/built-in/component/teleport/teleport.test.js
+3
-3
pages/built-in/component/template/template-map-style.test.js
pages/built-in/component/template/template-map-style.test.js
+0
-18
pages/built-in/special-elements/component/component-composition.uvue
...-in/special-elements/component/component-composition.uvue
+0
-0
pages/built-in/special-elements/component/component-options.uvue
...uilt-in/special-elements/component/component-options.uvue
+0
-0
pages/built-in/special-elements/component/component.test.js
pages/built-in/special-elements/component/component.test.js
+2
-2
pages/built-in/special-elements/slots/child-composition.uvue
pages/built-in/special-elements/slots/child-composition.uvue
+0
-0
pages/built-in/special-elements/slots/child-options.uvue
pages/built-in/special-elements/slots/child-options.uvue
+0
-0
pages/built-in/special-elements/slots/slots-composition.uvue
pages/built-in/special-elements/slots/slots-composition.uvue
+0
-0
pages/built-in/special-elements/slots/slots-options.uvue
pages/built-in/special-elements/slots/slots-options.uvue
+0
-0
pages/built-in/special-elements/slots/slots.test.js
pages/built-in/special-elements/slots/slots.test.js
+3
-4
pages/built-in/special-elements/template/template-composition.uvue
...lt-in/special-elements/template/template-composition.uvue
+13
-15
pages/built-in/special-elements/template/template-map-style-composition.uvue
...ial-elements/template/template-map-style-composition.uvue
+0
-0
pages/built-in/special-elements/template/template-map-style-options.uvue
...special-elements/template/template-map-style-options.uvue
+0
-0
pages/built-in/special-elements/template/template-map-style.test.js
...t-in/special-elements/template/template-map-style.test.js
+27
-0
pages/built-in/special-elements/template/template-options.uvue
.../built-in/special-elements/template/template-options.uvue
+10
-5
pages/built-in/special-elements/template/template.test.js
pages/built-in/special-elements/template/template.test.js
+7
-5
pages/component-instance/mixins/components/Comp2.uvue
pages/component-instance/mixins/components/Comp2.uvue
+1
-1
pages/component-instance/mixins/mixins-app.test.js
pages/component-instance/mixins/mixins-app.test.js
+1
-1
pages/component-instance/props/array-literal-options.uvue
pages/component-instance/props/array-literal-options.uvue
+0
-1
pages/component-instance/root/child-composition.uvue
pages/component-instance/root/child-composition.uvue
+5
-0
pages/component-instance/root/root-composition.uvue
pages/component-instance/root/root-composition.uvue
+31
-26
pages/component-instance/root/root.test.js
pages/component-instance/root/root.test.js
+6
-9
pages/directive/v-bind/v-bind-options.uvue
pages/directive/v-bind/v-bind-options.uvue
+2
-3
pages/directive/v-bind/v-bind.test.js
pages/directive/v-bind/v-bind.test.js
+1
-0
pages/directive/v-html/v-html.test.js
pages/directive/v-html/v-html.test.js
+3
-3
pages/examples/set-custom-child-component-root-node-class/set-custom-child-component-root-node-class.test.js
...-class/set-custom-child-component-root-node-class.test.js
+2
-2
pages/index/index.uvue
pages/index/index.uvue
+80
-68
pages/reactivity/utilities/to-value/to-value.test.js
pages/reactivity/utilities/to-value/to-value.test.js
+8
-3
pages/reactivity/utilities/to-value/to-value.uvue
pages/reactivity/utilities/to-value/to-value.uvue
+1
-1
未找到文件。
pages.json
浏览文件 @
1652db87
...
...
@@ -122,19 +122,6 @@
}
},
//
#endif
{
"path"
:
"pages/built-in/component/keep-alive/keep-alive-options"
,
"style"
:
{
"navigationBarTitleText"
:
"keep-alive 选项式 API"
}
},
{
"path"
:
"pages/built-in/component/keep-alive/keep-alive-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"keep-alive 组合式 API"
}
},
{
"path"
:
"pages/directive/v-html/v-html-options"
,
"style"
:
{
...
...
@@ -655,58 +642,84 @@
"enablePullDownRefresh"
:
true
}
},
{
"path"
:
"pages/built-in/component/keep-alive/keep-alive-options"
,
"style"
:
{
"navigationBarTitleText"
:
"keep-alive 选项式 API"
}
},
{
"path"
:
"pages/built-in/component/keep-alive/keep-alive-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"keep-alive 组合式 API"
}
},
{
"path"
:
"pages/built-in/component/teleport/teleport-options"
,
"style"
:
{
"navigationBarTitleText"
:
"teleport 选项式 API"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/built-in/component/teleport/teleport-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"teleport 组合式 API"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/built-in/
component
/slots/slots-composition"
,
"path"
:
"pages/built-in/
special-elements
/slots/slots-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"slots 组合式 API"
}
},
{
"path"
:
"pages/built-in/
component
/slots/slots-options"
,
"path"
:
"pages/built-in/
special-elements
/slots/slots-options"
,
"style"
:
{
"navigationBarTitleText"
:
"slots 选项式 API"
}
},
{
"path"
:
"pages/built-in/
component
/template/template-options"
,
"path"
:
"pages/built-in/
special-elements
/template/template-options"
,
"style"
:
{
"navigationBarTitleText"
:
"template 选项式 API"
}
},
{
"path"
:
"pages/built-in/
component
/template/template-composition"
,
"path"
:
"pages/built-in/
special-elements
/template/template-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"template 组合式 API"
}
},
{
"path"
:
"pages/built-in/
component
/template/template-map-style-options"
,
"path"
:
"pages/built-in/
special-elements
/template/template-map-style-options"
,
"style"
:
{
"navigationBarTitleText"
:
"template-map-style 选项式 API"
}
},
{
"path"
:
"pages/built-in/
component
/template/template-map-style-composition"
,
"path"
:
"pages/built-in/
special-elements
/template/template-map-style-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"template-map-style 组合式 API"
}
},
{
"path"
:
"pages/
rendering/unrecognized-component/unrecognized-component
"
,
"path"
:
"pages/
built-in/special-elements/component/component-options
"
,
"style"
:
{
"navigationBarTitleText"
:
"
unrecognized-component
"
"navigationBarTitleText"
:
"
component 选项式 API
"
}
},
{
"path"
:
"pages/built-in/
component/component/component-options
"
,
"path"
:
"pages/built-in/
special-elements/component/component-composition
"
,
"style"
:
{
"navigationBarTitleText"
:
"component
选项
式 API"
"navigationBarTitleText"
:
"component
组合
式 API"
}
},
{
"path"
:
"pages/
built-in/component/component/component-composition
"
,
"path"
:
"pages/
rendering/unrecognized-component/unrecognized-component
"
,
"style"
:
{
"navigationBarTitleText"
:
"
component 组合式 API
"
"navigationBarTitleText"
:
"
unrecognized-component
"
}
},
{
...
...
@@ -739,20 +752,6 @@
"navigationBarTitleText"
:
"自定义组件中使用 class 定制另一个自定义组件根节点样式 组合式 API"
}
},
{
"path"
:
"pages/built-in/component/teleport/teleport-options"
,
"style"
:
{
"navigationBarTitleText"
:
"teleport 选项式 API"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/built-in/component/teleport/teleport-composition"
,
"style"
:
{
"navigationBarTitleText"
:
"teleport 组合式 API"
,
"enablePullDownRefresh"
:
false
}
},
{
"path"
:
"pages/type/type"
,
"style"
:
{
...
...
pages/app-instance/globalProperties/globalProperties.test.js
浏览文件 @
1652db87
const
OPTIONS_PAGE_PATH
=
'
/pages/app-instance/globalProperties/globalProperties-options
'
const
COMPOSITION_PAGE_PATH
=
'
/pages/app-instance/globalProperties/globalProperties-composition
'
const
COMPOSITION_PAGE_PATH
=
'
/pages/app-instance/globalProperties/globalProperties-composition
'
describe
(
'
globalProperties
'
,
()
=>
{
let
page
=
null
const
testGlobalProperties
=
async
(
page
)
=>
{
let
data
=
await
page
.
data
()
await
page
.
waitFor
(
1000
)
let
data
=
await
page
.
data
()
await
page
.
waitFor
(
1000
)
expect
(
data
.
myGlobalProperties
.
str
).
toBe
(
'
default string
'
)
expect
(
data
.
myGlobalProperties
.
num
).
toBe
(
0
)
expect
(
data
.
myGlobalProperties
.
bool
).
toBe
(
false
)
...
...
@@ -54,7 +54,7 @@ describe('globalProperties', () => {
const
image
=
await
program
.
screenshot
({
fullPage
:
true
});
expect
(
image
).
to
Match
ImageSnapshot
();
expect
(
image
).
to
Save
ImageSnapshot
();
}
it
(
'
globalProperties options API
'
,
async
()
=>
{
...
...
@@ -68,7 +68,7 @@ describe('globalProperties', () => {
})
it
(
'
globalProperties composition API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
COMPOSITION_PAGE_PATH
)
page
=
await
program
.
reLaunch
(
COMPOSITION_PAGE_PATH
)
// 等待 globalProperties-options resetGlobalProperties 完成
await
page
.
waitFor
(
1500
)
...
...
pages/built-in/component/keep-alive/keep-alive.test.js
浏览文件 @
1652db87
const
PAGE_PATH_OPTIONS
=
'
/pages/built-in
-
component/keep-alive/keep-alive-options
'
const
PAGE_PATH_COMPOSITION
=
'
/pages/built-in
-
component/keep-alive/keep-alive-composition
'
const
PAGE_PATH_OPTIONS
=
'
/pages/built-in
/
component/keep-alive/keep-alive-options
'
const
PAGE_PATH_COMPOSITION
=
'
/pages/built-in
/
component/keep-alive/keep-alive-composition
'
describe
(
'
keep-alive
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
ios
'
))
{
...
...
pages/built-in/component/teleport/teleport.test.js
浏览文件 @
1652db87
const
PAGE_PATH_OPTIONS
=
'
/pages/built-in
-
component/teleport/teleport-options
'
const
PAGE_PATH_COMPONSITION
=
'
/pages/built-in
-
component/teleport/teleport-composition
'
const
PAGE_PATH_OPTIONS
=
'
/pages/built-in
/
component/teleport/teleport-options
'
const
PAGE_PATH_COMPONSITION
=
'
/pages/built-in
/
component/teleport/teleport-composition
'
describe
(
'
teleport
'
,
()
=>
{
if
(
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
().
startsWith
(
'
ios
'
))
{
...
...
@@ -14,7 +14,7 @@ describe('teleport', () => {
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
500
)
const
image
=
await
program
.
screenshot
();
expect
(
image
).
to
Match
ImageSnapshot
();
expect
(
image
).
to
Save
ImageSnapshot
();
}
it
(
'
teleport Options API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH_OPTIONS
)
...
...
pages/built-in/component/template/template-map-style.test.js
已删除
100644 → 0
浏览文件 @
d4632f07
describe
(
'
/pages/rendering/template/template-map-style
'
,
()
=>
{
let
page
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
'
/pages/rendering/template/template-map-style
'
)
await
page
.
waitFor
(
1000
)
})
it
(
'
init screen shot
'
,
async
()
=>
{
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
it
(
'
change isClassValid screen shot
'
,
async
()
=>
{
const
btn
=
await
page
.
$
(
'
#btn
'
)
await
btn
.
tap
()
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
})
});
\ No newline at end of file
pages/built-in/
component
/component/component-composition.uvue
→
pages/built-in/
special-elements
/component/component-composition.uvue
浏览文件 @
1652db87
文件已移动
pages/built-in/
component
/component/component-options.uvue
→
pages/built-in/
special-elements
/component/component-options.uvue
浏览文件 @
1652db87
文件已移动
pages/built-in/
component
/component/component.test.js
→
pages/built-in/
special-elements
/component/component.test.js
浏览文件 @
1652db87
const
PAGE_OPTIONS
=
'
/pages/built-in/
component
/component/component-options
'
const
PAGE_COMPOSITION
=
'
/pages/built-in/
component
/component/component-composition
'
const
PAGE_OPTIONS
=
'
/pages/built-in/
special-elements
/component/component-options
'
const
PAGE_COMPOSITION
=
'
/pages/built-in/
special-elements
/component/component-composition
'
describe
(
'
built-in/component
'
,
()
=>
{
let
page
...
...
pages/built-in/
component
/slots/child-composition.uvue
→
pages/built-in/
special-elements
/slots/child-composition.uvue
浏览文件 @
1652db87
文件已移动
pages/built-in/
component
/slots/child-options.uvue
→
pages/built-in/
special-elements
/slots/child-options.uvue
浏览文件 @
1652db87
文件已移动
pages/built-in/
component
/slots/slots-composition.uvue
→
pages/built-in/
special-elements
/slots/slots-composition.uvue
浏览文件 @
1652db87
文件已移动
pages/built-in/
component
/slots/slots-options.uvue
→
pages/built-in/
special-elements
/slots/slots-options.uvue
浏览文件 @
1652db87
文件已移动
pages/built-in/
component
/slots/slots.test.js
→
pages/built-in/
special-elements
/slots/slots.test.js
浏览文件 @
1652db87
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
const
PAGE_OPTIONS
=
'
/pages/built-in/component/slots/slots-options
'
const
PAGE_COMPOSITION
=
'
/pages/built-in/component/slots/slots-composition
'
const
PAGE_OPTIONS
=
'
/pages/built-in/special-elements/slots/slots-options
'
const
PAGE_COMPOSITION
=
'
/pages/built-in/special-elements/slots/slots-composition
'
describe
(
'
built-in/
component
/slots
'
,
()
=>
{
describe
(
'
built-in/
special-elements
/slots
'
,
()
=>
{
let
page
;
const
test
=
async
()
=>
{
...
...
pages/built-in/
component
/template/template-composition.uvue
→
pages/built-in/
special-elements
/template/template-composition.uvue
浏览文件 @
1652db87
<template>
<view class="page">
<template v-if="isShow">
<template v-if="
dataInfo.
isShow">
<view class="title">{{ title }}</view>
</template>
<view class="show-botton" @click="handleShow">{{ isShow ? '点击隐藏' : '点击显示' }}</view>
<view class="show-botton" @click="handleShow">{{
dataInfo.
isShow ? '点击隐藏' : '点击显示' }}</view>
<template v-for="(item, index) in list" :key="index">
<view class="item">{{ index + 1 }}.{{ item.name }}</view>
</template>
...
...
@@ -12,23 +12,16 @@
</template>
<script setup lang="uts">
type DataInfo = {
isShow: boolean
}
type ListItem = {
name: string
}
// 自动化测试拿不到 ref
defineOptions({
data() {
return {
isShow: false
}
},
methods: {
handleShow() {
this.isShow = !this.isShow
}
}
})
const dataInfo = reactive({
isShow: false
} as DataInfo)
const title = ref<string>('hello')
const list = ref<ListItem[]>([
...
...
@@ -40,11 +33,16 @@ const list = ref<ListItem[]>([
}
] as ListItem[])
const handleShow = () => {
dataInfo.isShow = !dataInfo.isShow
}
const goMapStyle = () => {
uni.navigateTo({ url: '/pages/built-in/component/template/template-map-style-composition' })
}
defineExpose({
dataInfo,
goMapStyle
})
</script>
...
...
pages/built-in/
component
/template/template-map-style-composition.uvue
→
pages/built-in/
special-elements
/template/template-map-style-composition.uvue
浏览文件 @
1652db87
文件已移动
pages/built-in/
component
/template/template-map-style-options.uvue
→
pages/built-in/
special-elements
/template/template-map-style-options.uvue
浏览文件 @
1652db87
文件已移动
pages/built-in/special-elements/template/template-map-style.test.js
0 → 100644
浏览文件 @
1652db87
const
OPTIONS_PAGE_PATH
=
'
/pages/built-in/special-elements/template/template-map-style-options
'
const
COMPOSITION_PAGE_PATH
=
'
/pages/built-in/special-elements/template/template-map-style-composition
'
describe
(
'
/pages/built-in/special-elements/template-map-style
'
,
()
=>
{
let
page
const
test
=
async
(
pagePath
)
=>
{
page
=
await
program
.
reLaunch
(
pagePath
)
await
page
.
waitFor
(
'
view
'
)
const
initImage
=
await
program
.
screenshot
();
expect
(
initImage
).
toSaveImageSnapshot
();
const
btn
=
await
page
.
$
(
'
#btn
'
)
await
btn
.
tap
()
await
page
.
waitFor
(
100
)
const
changedImage
=
await
program
.
screenshot
();
expect
(
changedImage
).
toSaveImageSnapshot
();
}
it
(
'
template map style options API
'
,
async
()
=>
{
await
test
(
OPTIONS_PAGE_PATH
)
})
it
(
'
template map style composition API
'
,
async
()
=>
{
await
test
(
COMPOSITION_PAGE_PATH
)
})
});
\ No newline at end of file
pages/built-in/
component
/template/template-options.uvue
→
pages/built-in/
special-elements
/template/template-options.uvue
浏览文件 @
1652db87
<template>
<view class="page">
<template v-if="isShow">
<template v-if="
dataInfo.
isShow">
<view class="title">{{ title }}</view>
</template>
<view class="show-botton" @click="handleShow">{{ isShow ? '点击隐藏' : '点击显示' }}</view>
<view class="show-botton" @click="handleShow">{{
dataInfo.
isShow ? '点击隐藏' : '点击显示' }}</view>
<template v-for="(item, index) in list" :key="index">
<view class="item">{{ index + 1 }}.{{ item.name }}</view>
</template>
...
...
@@ -11,7 +11,10 @@
</view>
</template>
<script>
<script lang='uts'>
type DataInfo = {
isShow: boolean
}
type objType = {
name : string
}
...
...
@@ -19,7 +22,9 @@ export default {
data() {
return {
title: "hello",
isShow: false,
dataInfo: {
isShow: false,
} as DataInfo,
list: [{
name: 'foo1'
},
...
...
@@ -31,7 +36,7 @@ export default {
},
methods: {
handleShow() {
this.
isShow = !this
.isShow
this.
dataInfo.isShow = !this.dataInfo
.isShow
},
goMapStyle() {
uni.navigateTo({ url: '/pages/built-in/component/template/template-map-style-options' })
...
...
pages/built-in/
component
/template/template.test.js
→
pages/built-in/
special-elements
/template/template.test.js
浏览文件 @
1652db87
const
PAGE_PATH_OPTIONS
=
'
/pages/built-in/
component
/template/template-options
'
const
PAGE_PATH_COMPO
NSITION
=
'
/pages/built-in/component
/template/template-composition
'
const
PAGE_PATH_OPTIONS
=
'
/pages/built-in/
special-elements
/template/template-options
'
const
PAGE_PATH_COMPO
SITION
=
'
/pages/built-in/special-elements
/template/template-composition
'
describe
(
'
built-in/component
'
,
()
=>
{
describe
(
'
built-in/
special-elements/
component
'
,
()
=>
{
let
page
const
test
=
async
()
=>
{
await
page
.
waitFor
(
'
view
'
)
expect
.
assertions
(
4
);
const
showBtn
=
await
page
.
$
(
'
.show-botton
'
)
await
showBtn
.
tap
()
expect
((
await
page
.
data
()).
isShow
).
toBeTruthy
()
const
dataInfo
=
await
page
.
data
(
'
dataInfo
'
)
expect
(
dataInfo
.
isShow
).
toBeTruthy
()
const
getTitle
=
await
page
.
$
(
'
.title
'
)
expect
(
await
getTitle
.
text
()).
toBe
(
"
hello
"
)
const
getShow
=
await
page
.
$
(
'
.show-botton
'
)
...
...
@@ -20,7 +22,7 @@ describe('built-in/component', () => {
await
test
()
})
it
(
'
template Composition API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH_COMPO
N
SITION
)
page
=
await
program
.
reLaunch
(
PAGE_PATH_COMPOSITION
)
await
test
()
})
});
\ No newline at end of file
pages/component-instance/mixins/components/Comp2.uvue
浏览文件 @
1652db87
...
...
@@ -47,7 +47,7 @@ export default {
},
mounted(){
const rootElement = this.$refs['mixin-comp-root'] as UniElement
this.rootElementTitle =
JSON.stringify(rootElement.getAttribute('title')
)
this.rootElementTitle =
rootElement.getAttribute('title'
)
},
watch: {
globalMixinOnloadMsg1(newVal: string) {
...
...
pages/component-instance/mixins/mixins-app.test.js
浏览文件 @
1652db87
...
...
@@ -17,7 +17,7 @@ describe('mixins', () => {
it
(
'
inheritAttrs
'
,
async
()
=>
{
const
comp1RootElementTitleEl
=
await
page
.
$
(
'
.root-element-title-1
'
)
const
comp1RootElementTitleText
=
await
comp1RootElementTitleEl
.
text
()
expect
(
comp1RootElementTitleText
).
toBe
(
'
rootElementTitle:
'
)
expect
(
comp1RootElementTitleText
).
toBe
(
'
rootElementTitle:
null
'
)
const
comp2RootElementTitleEl
=
await
page
.
$
(
'
.root-element-title-2
'
)
const
comp2RootElementTitleText
=
await
comp2RootElementTitleEl
.
text
()
expect
(
comp2RootElementTitleText
).
toBe
(
'
rootElementTitle: title
'
)
...
...
pages/component-instance/props/array-literal-options.uvue
浏览文件 @
1652db87
...
...
@@ -28,7 +28,6 @@
export default {
props: ['str', 'num', 'bool', 'obj', 'arr'],
mounted() {
console.log('this.$props is Map', this.$props, this.$props instanceof Map);
console.log('this.$props.str: ',this.$props['str']);
console.log('this.$props.num: ',this.$props['num']);
console.log('this.$props.bool: ',this.$props['bool']);
...
...
pages/component-instance/root/child-composition.uvue
浏览文件 @
1652db87
...
...
@@ -11,6 +11,11 @@ const rootStr = ref('')
onMounted(() => {
const instance = getCurrentInstance()!.proxy!
// #ifdef APP-ANDROID
rootStr.value = (instance.$root!.$exposed['str'] as Ref<string>).value as string
// #endif
// #ifndef APP-ANDROID
rootStr.value = instance.$root!['str'] as string
// #endif
})
</script>
pages/component-instance/root/root-composition.uvue
浏览文件 @
1652db87
<template>
<view class="page">
<view class="mb-10 flex justify-between flex-row">
<text>root str in parent component: </text>
<text id="root-str-parent">{{ rootStr }}</text>
</view>
<child />
</view>
</template>
<script setup lang="uts">
import Child from './child-composition.uvue'
const str = ref('root component str')
const rootStr = ref('')
onReady(() => {
const instance = getCurrentInstance()!.proxy!
rootStr.value = (instance.$root!.$exposed['str'] as Ref<string>).value as string
})
defineExpose({
str
})
</script>
<template>
<view class="page">
<view class="mb-10 flex justify-between flex-row">
<text>root str in parent component: </text>
<text id="root-str-parent">{{ rootStr }}</text>
</view>
<Child />
</view>
</template>
<script setup lang="uts">
import Child from './child-composition.uvue'
const str = ref('root component str')
const rootStr = ref('')
onReady(() => {
const instance = getCurrentInstance()!.proxy!
// TODO: 确认 android 与 ios 的差异, ios 与标准 vue 相同
// #ifdef APP-ANDROID
rootStr.value = (instance.$root!.$exposed['str'] as Ref<string>).value as string
// #endif
// #ifndef APP-ANDROID
rootStr.value = instance.$root!['str'] as string
// #endif
})
defineExpose({
str
})
</script>
\ No newline at end of file
pages/component-instance/root/root.test.js
浏览文件 @
1652db87
...
...
@@ -10,7 +10,10 @@ describe('$root', () => {
return
}
let
page
const
test
=
async
(
page
)
=>
{
const
test
=
async
(
pagePath
)
=>
{
page
=
await
program
.
reLaunch
(
pagePath
)
await
page
.
waitFor
(
'
view
'
)
const
rootStrParent
=
await
page
.
$
(
'
#root-str-parent
'
)
expect
(
await
rootStrParent
.
text
()).
toBe
(
'
root component str
'
)
...
...
@@ -19,16 +22,10 @@ describe('$root', () => {
}
it
(
'
$root 选项式 API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
OPTIONS_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
OPTIONS_PAGE_PATH
)
});
it
(
'
$root 组合式 API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
COMPOSITION_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
COMPOSITION_PAGE_PATH
)
})
})
pages/directive/v-bind/v-bind-options.uvue
浏览文件 @
1652db87
...
...
@@ -18,7 +18,7 @@
</view>
<!-- v-bind props -->
<Foo :title :num="dataInfo.fooProps.num" :obj="dataInfo.fooProps.obj" />
<Foo :title
="dataInfo.fooProps.title"
:num="dataInfo.fooProps.num" :obj="dataInfo.fooProps.obj" />
<!-- v-bind in style -->
<!-- #ifdef WEB -->
...
...
@@ -50,13 +50,12 @@ export default {
components: { Foo },
data() {
return {
title: 'foo title',
dataInfo: {
fontSize: '20px',
backgroundColor: 'background-color: green',
border: 'border: 2px solid red',
fooProps: {
title: '',
title: '
foo title
',
num: 1,
obj: {
name: 'foo obj name'
...
...
pages/directive/v-bind/v-bind.test.js
浏览文件 @
1652db87
...
...
@@ -4,6 +4,7 @@ const COMPOSITION_PAGE_PATH = '/pages/directive/v-bind/v-bind-composition'
describe
(
'
v-bind
'
,
()
=>
{
let
page
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isIos
=
platformInfo
.
startsWith
(
'
ios
'
)
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isFirefox
=
platformInfo
.
indexOf
(
'
firefox
'
)
>
-
1
...
...
pages/directive/v-html/v-html.test.js
浏览文件 @
1652db87
const
OPTIONS_PAGE_PATH
=
'
/pages/directive/v-html/v-html-options
'
const
COMPOSITION_PAGE_PATH
=
'
/pages/directive/v-html/v-html-composition
'
// TODO: ios 暂不支持
// TODO: ios 暂不支持
describe
(
'
v-html
'
,
()
=>
{
let
page
const
test
=
async
()
=>
{
const
image
=
await
program
.
screenshot
()
expect
(
image
).
to
Match
ImageSnapshot
()
expect
(
image
).
to
Save
ImageSnapshot
()
}
it
(
'
v-html options API
'
,
async
()
=>
{
...
...
pages/examples/set-custom-child-component-root-node-class/set-custom-child-component-root-node-class.test.js
浏览文件 @
1652db87
...
...
@@ -8,13 +8,13 @@ describe('自定义组件中使用 class 定制另一个自定义组件根节点
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
const
image
=
await
program
.
screenshot
()
expect
(
image
).
to
Match
ImageSnapshot
()
expect
(
image
).
to
Save
ImageSnapshot
()
})
it
(
'
set-custom-child-component-root-node-class-options Screenshot
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH_COMPOSITION
)
await
page
.
waitFor
(
'
view
'
)
const
image
=
await
program
.
screenshot
()
expect
(
image
).
to
Match
ImageSnapshot
()
expect
(
image
).
to
Save
ImageSnapshot
()
})
})
pages/index/index.uvue
浏览文件 @
1652db87
...
...
@@ -863,93 +863,105 @@ export default {
},
{
id: 'built-in',
name: '内置
组件
',
name: '内置',
pages: [
{
id:
'component/keep-alive
',
name: '
keep-alive
',
id:
'component
',
name: '
组件
',
children: [
{
id: 'keep-alive-options',
name: 'keep-alive 选项式 API',
url: 'keep-alive-options'
},
id: 'keep-alive',
name: 'keepAlive',
children: [
{
id: 'keep-alive-options',
name: 'keepAlive 选项式 API',
url: 'keep-alive-options'
},
{
id: 'keep-alive-composition',
name: 'keep-alive 组合式 API',
url: 'keep-alive-composition'
}
]
},
{
id: 'component/teleport',
name: 'teleport',
children: [
{
id: 'teleport-options',
name: 'teleport 选项式 API',
url: 'teleport-options'
{
id: 'keep-alive-composition',
name: 'keepAlive 组合式 API',
url: 'keep-alive-composition'
}
]
},
{
id: 'teleport-composition',
name: 'teleport 组合式 API',
url: 'teleport-composition'
}
]
},
{
id: 'component/component',
name: 'component',
children: [
{
id: 'component-options',
name: 'component 选项式 API',
url: 'component-options'
},
id: 'teleport',
name: 'Teleport',
children: [
{
id: 'teleport-options',
name: 'Teleport 选项式 API',
url: 'teleport-options'
},
{
id: 'component-composition',
name: 'component 组合式 API',
url: 'component-composition'
}
]
},
{
id: 'component/slots',
name: 'slot',
children: [
{
id: 'slots-options',
name: 'slots 选项式 API',
url: 'slots-options'
{
id: 'teleport-composition',
name: 'Teleport 组合式 API',
url: 'teleport-composition'
}
]
},
{
id: 'slots-composition',
name: 'slots 组合式 API',
url: 'slots-composition'
}
]
},
{
id:
'component/template
',
name: '
template
',
id:
'special-elements
',
name: '
特殊元素
',
children: [
{
id: 'template-options',
name: 'template 选项式 API',
url: 'template-options'
id: 'component',
name: 'component',
children: [
{
id: 'component-options',
name: 'component 选项式 API',
url: 'component-options'
},
{
id: 'component-composition',
name: 'component 组合式 API',
url: 'component-composition'
}
]
},
{
id: 'slots',
name: 'slot',
children: [
{
id: 'slots-options',
name: 'slots 选项式 API',
url: 'slots-options'
},
{
id: 'slots-composition',
name: 'slots 组合式 API',
url: 'slots-composition'
}
]
},
{
id: 'template-composition',
name: 'template 组合式 API',
url: 'template-composition'
id: 'template',
name: 'template',
children: [
{
id: 'template-options',
name: 'template 选项式 API',
url: 'template-options'
},
{
id: 'template-composition',
name: 'template 组合式 API',
url: 'template-composition'
}
]
}
]
}
}
,
] as Page[]
},
{
...
...
pages/reactivity/utilities/to-value/to-value.test.js
浏览文件 @
1652db87
const
PAGE_PATH
=
'
/pages/reactivity/utilities/to-value/to-value
'
const
PAGE_PATH
=
'
/pages/reactivity/utilities/to-value/to-value
'
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
()
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
describe
(
'
toValue
'
,
()
=>
{
let
page
=
null
...
...
@@ -24,7 +26,10 @@ describe('toValue', () => {
const
incrementBtn
=
await
page
.
$
(
'
#increment-btn
'
)
await
incrementBtn
.
tap
()
expect
(
await
objNum
.
text
()).
toBe
(
'
1
'
)
expect
(
await
toValueObjNum
.
text
()).
toBe
(
'
1
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
1
'
)
if
(
!
isWeb
){
// 数据更新成功,但因为 web 端 text 为组件,所以视图未更新
expect
(
await
toValueObjNum
.
text
()).
toBe
(
'
1
'
)
}
})
})
\ No newline at end of file
pages/reactivity/utilities/to-value/to-value.uvue
浏览文件 @
1652db87
...
...
@@ -43,7 +43,7 @@ const obj = reactive({
num: 0
} as Obj)
let toValueObjNum = toValue(() : number =>
obj.num
)
let toValueObjNum = toValue(() : number =>
0
)
const increment = () => {
obj.num++;
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录