Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
e19271a2
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
362
Star
3
Fork
8
代码
文件
提交
分支
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看板
提交
e19271a2
编写于
1月 25, 2024
作者:
W
wangjinxin613
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test:调整若干示例兼容 safari
上级
87c3aee0
变更
7
隐藏空白更改
内联
并排
Showing
7 changed file
with
34 addition
and
27 deletion
+34
-27
pages/composition-api/basic/define-props/define-props.test.js
...s/composition-api/basic/define-props/define-props.test.js
+8
-7
pages/composition-api/basic/define-slots/define-slots.test.js
...s/composition-api/basic/define-slots/define-slots.test.js
+3
-2
pages/composition-api/basic/use-slots/use-slots.test.js
pages/composition-api/basic/use-slots/use-slots.test.js
+3
-2
pages/composition-api/dependency-injection/provide/provide-inject.test.js
...n-api/dependency-injection/provide/provide-inject.test.js
+4
-3
pages/composition-api/reactivity/computed/computed.test.js
pages/composition-api/reactivity/computed/computed.test.js
+4
-3
pages/composition-api/reactivity/reactive/reactive.test.js
pages/composition-api/reactivity/reactive/reactive.test.js
+4
-3
pages/composition-api/reactivity/readonly/readonly.test.js
pages/composition-api/reactivity/readonly/readonly.test.js
+8
-7
未找到文件。
pages/composition-api/basic/define-props/define-props.test.js
浏览文件 @
e19271a2
const
PAGE_PATH
=
'
/pages/composition-api/basic/define-props/define-props
'
describe
(
'
defineProps
'
,
()
=>
{
describe
(
'
defineProps
'
,
()
=>
{
const
isSafari
=
process
.
env
.
uniTestPlatformInfo
.
indexOf
(
'
safari
'
)
>
-
1
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -14,7 +15,7 @@ describe('defineProps', () => {
const
arrayLiteralBool
=
await
page
.
$
(
'
#array-literal-bool
'
)
expect
(
await
arrayLiteralBool
.
text
()).
toBe
(
'
bool: false
'
)
const
arrayLiteralArr
=
await
page
.
$
(
'
#array-literal-arr
'
)
expect
(
await
arrayLiteralArr
.
text
()).
toBe
(
'
arr: ["a","b","c"]
'
)
expect
(
await
arrayLiteralArr
.
text
()).
toBe
(
isSafari
?
'
arr: [ "a", "b", "c"]
'
:
'
arr: ["a","b","c"]
'
)
const
arrayLiteralObj
=
await
page
.
$
(
'
#array-literal-obj
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
...
...
@@ -22,7 +23,7 @@ describe('defineProps', () => {
}
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
expect
(
await
arrayLiteralObj
.
text
()).
toBe
(
'
obj: {"str": "obj str","num": 0,"arr": [1,2,3]}
'
)
isSafari
?
'
obj: { "str": "obj str", "num": 0, "arr": [ 1, 2, 3 ]}
'
:
'
obj: {"str": "obj str","num": 0,"arr": [1,2,3]}
'
)
}
const
arrayLiteralFn
=
await
page
.
$
(
'
#array-literal-fn
'
)
...
...
@@ -35,14 +36,14 @@ describe('defineProps', () => {
const
objectLiteralBool
=
await
page
.
$
(
'
#object-literal-bool
'
)
expect
(
await
objectLiteralBool
.
text
()).
toBe
(
'
bool: false
'
)
const
objectLiteralArr
=
await
page
.
$
(
'
#object-literal-arr
'
)
expect
(
await
objectLiteralArr
.
text
()).
toBe
(
'
arr: ["a","b","c"]
'
)
expect
(
await
objectLiteralArr
.
text
()).
toBe
(
isSafari
?
'
arr: [ "a", "b", "c"]
'
:
'
arr: ["a","b","c"]
'
)
const
objectLiteralObj
=
await
page
.
$
(
'
#object-literal-obj
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
await
objectLiteralObj
.
text
()).
toBe
(
'
obj: {"a":1}
'
)
}
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
expect
(
await
objectLiteralObj
.
text
()).
toBe
(
'
obj: {"a": 1}
'
)
expect
(
await
objectLiteralObj
.
text
()).
toBe
(
isSafari
?
'
obj: { "a": 1}
'
:
'
obj: {"a": 1}
'
)
}
const
objectLiteralFn
=
await
page
.
$
(
'
#object-literal-fn
'
)
...
...
@@ -55,14 +56,14 @@ describe('defineProps', () => {
const
typeBool
=
await
page
.
$
(
'
#type-bool
'
)
expect
(
await
typeBool
.
text
()).
toBe
(
'
bool: false
'
)
const
typeArr
=
await
page
.
$
(
'
#type-arr
'
)
expect
(
await
typeArr
.
text
()).
toBe
(
'
arr: ["a","b","c"]
'
)
expect
(
await
typeArr
.
text
()).
toBe
(
isSafari
?
'
arr: [ "a", "b", "c"]
'
:
'
arr: ["a","b","c"]
'
)
const
typeObj
=
await
page
.
$
(
'
#type-obj
'
)
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
android
'
))
{
expect
(
await
typeObj
.
text
()).
toBe
(
'
obj: {"arr":[1,2,3],"num":0,"str":"obj str"}
'
)
}
if
(
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
))
{
expect
(
await
typeObj
.
text
()).
toBe
(
'
obj: {"str": "obj str","num": 0,"arr": [1,2,3]}
'
)
expect
(
await
typeObj
.
text
()).
toBe
(
isSafari
?
'
obj: { "str": "obj str", "num": 0, "arr": [ 1, 2, 3 ]}
'
:
'
obj: {"str": "obj str","num": 0,"arr": [1,2,3]}
'
)
}
const
typeFn
=
await
page
.
$
(
'
#type-fn
'
)
...
...
pages/composition-api/basic/define-slots/define-slots.test.js
浏览文件 @
e19271a2
const
PAGE_PATH
=
'
/pages/composition-api/basic/define-slots/define-slots
'
describe
(
'
defineSlots
'
,
()
=>
{
describe
(
'
defineSlots
'
,
()
=>
{
const
isSafari
=
process
.
env
.
uniTestPlatformInfo
.
indexOf
(
'
safari
'
)
>
-
1
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -14,6 +15,6 @@ describe('defineSlots', () => {
expect
(
await
slotContent
.
text
()).
toBe
(
'
default slot num: 0
'
)
const
slotFooter
=
await
page
.
$
(
'
#slot-footer
'
)
expect
(
await
slotFooter
.
text
()).
toBe
(
'
footer slot arr: ["a","b","c"]
'
)
expect
(
await
slotFooter
.
text
()).
toBe
(
isSafari
?
'
footer slot arr: [ "a", "b", "c"]
'
:
'
footer slot arr: ["a","b","c"]
'
)
})
})
\ No newline at end of file
pages/composition-api/basic/use-slots/use-slots.test.js
浏览文件 @
e19271a2
const
PAGE_PATH
=
'
/pages/composition-api/basic/use-slots/use-slots
'
describe
(
'
useSlots
'
,
()
=>
{
describe
(
'
useSlots
'
,
()
=>
{
const
isSafari
=
process
.
env
.
uniTestPlatformInfo
.
indexOf
(
'
safari
'
)
>
-
1
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -14,7 +15,7 @@ describe('useSlots', () => {
expect
(
await
slotContent
.
text
()).
toBe
(
'
default slot msg: default msg
'
)
const
slotFooter
=
await
page
.
$
(
'
#slot-footer
'
)
expect
(
await
slotFooter
.
text
()).
toBe
(
'
footer slot arr: ["a","b","c"]
'
)
expect
(
await
slotFooter
.
text
()).
toBe
(
isSafari
?
'
footer slot arr: [ "a", "b", "c"]
'
:
'
footer slot arr: ["a","b","c"]
'
)
const
checkUseSlotsRes
=
await
page
.
$
(
'
#check-use-slots-res
'
)
expect
(
await
checkUseSlotsRes
.
text
()).
toBe
(
'
check useSlots result: false
'
)
...
...
pages/composition-api/dependency-injection/provide/provide-inject.test.js
浏览文件 @
e19271a2
const
PAGE_PATH
=
'
/pages/composition-api/dependency-injection/provide/provide
'
describe
(
'
provide-inject-hasInjectionContext
'
,
()
=>
{
describe
(
'
provide-inject-hasInjectionContext
'
,
()
=>
{
const
isSafari
=
process
.
env
.
uniTestPlatformInfo
.
indexOf
(
'
safari
'
)
>
-
1
const
isWeb
=
process
.
env
.
uniTestPlatformInfo
.
startsWith
(
'
web
'
)
let
page
=
null
beforeAll
(
async
()
=>
{
...
...
@@ -15,11 +16,11 @@ describe('provide-inject-hasInjectionContext', () => {
expect
(
await
num
.
text
()).
toBe
(
'
num: 0
'
)
const
obj
=
await
page
.
$
(
'
.obj
'
)
expect
(
await
obj
.
text
()).
toBe
(
isWeb
?
'
obj: {"a": 1}
'
:
'
obj: {"a":1}
'
)
expect
(
await
obj
.
text
()).
toBe
(
isWeb
?
(
isSafari
?
'
obj: { "a": 1}
'
:
'
obj: {"a": 1}
'
)
:
'
obj: {"a":1}
'
)
const
arr
=
await
page
.
$
(
'
.arr
'
)
expect
(
await
arr
.
text
()).
toBe
(
'
arr: [1,2,3]
'
)
expect
(
await
arr
.
text
()).
toBe
(
isSafari
?
'
arr: [ 1, 2, 3]
'
:
'
arr: [1,2,3]
'
)
const
fn
=
await
page
.
$
(
'
.fn
'
)
expect
(
await
fn
.
text
()).
toBe
(
'
fn: hello
'
)
...
...
pages/composition-api/reactivity/computed/computed.test.js
浏览文件 @
e19271a2
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/computed/computed
'
describe
(
'
computed
'
,
()
=>
{
describe
(
'
computed
'
,
()
=>
{
const
isSafari
=
process
.
env
.
uniTestPlatformInfo
.
indexOf
(
'
safari
'
)
>
-
1
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -13,7 +14,7 @@ describe('computed', () => {
expect
(
await
doubleCount
.
text
()).
toBe
(
'
computed double count: 0
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [1,2,3]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isSafari
?
'
obj.arr: [ 1, 2, 3]
'
:
'
obj.arr: [1,2,3]
'
)
const
objArrLen
=
await
page
.
$
(
'
#obj-arr-len
'
)
expect
(
await
objArrLen
.
text
()).
toBe
(
'
computed obj.arr.length: 3
'
)
...
...
@@ -22,7 +23,7 @@ describe('computed', () => {
expect
(
await
count
.
text
()).
toBe
(
'
count: 1
'
)
expect
(
await
doubleCount
.
text
()).
toBe
(
'
computed double count: 2
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: [1,2,3,4]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isSafari
?
'
obj.arr: [ 1, 2, 3, 4]
'
:
'
obj.arr: [1,2,3,4]
'
)
expect
(
await
objArrLen
.
text
()).
toBe
(
'
computed obj.arr.length: 4
'
)
})
...
...
pages/composition-api/reactivity/reactive/reactive.test.js
浏览文件 @
e19271a2
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/reactive/reactive
'
describe
(
'
reactive
'
,
()
=>
{
describe
(
'
reactive
'
,
()
=>
{
const
isSafari
=
process
.
env
.
uniTestPlatformInfo
.
indexOf
(
'
safari
'
)
>
-
1
let
page
=
null
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -17,7 +18,7 @@ describe('reactive', () => {
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 0
'
)
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: ["a","b","c"]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isSafari
?
'
obj.arr: [ "a", "b", "c"]
'
:
'
obj.arr: ["a","b","c"]
'
)
const
updateBtn
=
await
page
.
$
(
'
.update-btn
'
)
await
updateBtn
.
tap
()
...
...
@@ -25,6 +26,6 @@ describe('reactive', () => {
expect
(
await
count
.
text
()).
toBe
(
'
count: 2
'
)
expect
(
await
objStr
.
text
()).
toBe
(
'
obj.str: new str
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
obj.num: 2
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
obj.arr: ["a","b","c","d"]
'
)
expect
(
await
objArr
.
text
()).
toBe
(
isSafari
?
'
obj.arr: [ "a", "b", "c", "d"]
'
:
'
obj.arr: ["a","b","c","d"]
'
)
})
})
\ No newline at end of file
pages/composition-api/reactivity/readonly/readonly.test.js
浏览文件 @
e19271a2
const
PAGE_PATH
=
'
/pages/composition-api/reactivity/readonly/readonly
'
describe
(
'
ref
'
,
()
=>
{
describe
(
'
ref
'
,
()
=>
{
const
isSafari
=
process
.
env
.
uniTestPlatformInfo
.
indexOf
(
'
safari
'
)
>
-
1
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
(
isSafari
?
'
data.arr: [ "a", "b", "c"]
'
:
'
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
(
isSafari
?
'
readonly data.arr: [ "a", "b", "c"]
'
:
'
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
(
isSafari
?
'
data.arr: [ "a", "b", "c", "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
(
isSafari
?
'
readonly data.arr: [ "a", "b", "c", "d"]
'
:
'
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
(
isSafari
?
'
data.arr: [ "a", "b", "c", "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
(
isSafari
?
'
readonly data.arr: [ "a", "b", "c", "d"]
'
:
'
readonly data.arr: ["a","b","c","d"]
'
)
})
})
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录