Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello-uvue
提交
c7e4278c
H
hello-uvue
项目概览
DCloud
/
hello-uvue
通知
398
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看板
You need to sign in or sign up before continuing.
提交
c7e4278c
编写于
12月 17, 2024
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
差异文件
Merge branch 'dev' into alpha
上级
e9d63269
301366f8
变更
28
隐藏空白更改
内联
并排
Showing
28 changed file
with
111 addition
and
87 deletion
+111
-87
jest.config.js
jest.config.js
+2
-2
pages/app-instance/globalProperties/globalProperties.test.js
pages/app-instance/globalProperties/globalProperties.test.js
+1
-1
pages/built-in/special-elements/template/template.test.js
pages/built-in/special-elements/template/template.test.js
+1
-0
pages/component-instance/attrs/attrs.test.js
pages/component-instance/attrs/attrs.test.js
+8
-14
pages/component-instance/emit-function/emit-function.test.js
pages/component-instance/emit-function/emit-function.test.js
+1
-0
pages/component-instance/force-update/force-update.test.js
pages/component-instance/force-update/force-update.test.js
+2
-0
pages/component-instance/parent/parent.test.js
pages/component-instance/parent/parent.test.js
+7
-10
pages/component-instance/props/props.test.js
pages/component-instance/props/props.test.js
+6
-10
pages/component-instance/provide/provide-composition.test.js
pages/component-instance/provide/provide-composition.test.js
+1
-0
pages/component-instance/root/root.test.js
pages/component-instance/root/root.test.js
+4
-5
pages/directive/v-if/v-if.test.js
pages/directive/v-if/v-if.test.js
+10
-10
pages/directive/v-model/v-model-options.test.js
pages/directive/v-model/v-model-options.test.js
+8
-7
pages/directive/v-on/v-on.test.js
pages/directive/v-on/v-on.test.js
+4
-3
pages/error/throw-error/throw-error.test.js
pages/error/throw-error/throw-error.test.js
+1
-0
pages/examples/nested-component-communication/nested-component-communication.test.js
...nent-communication/nested-component-communication.test.js
+3
-0
pages/reactivity/advanced/effect-scope/effect-scope.test.js
pages/reactivity/advanced/effect-scope/effect-scope.test.js
+10
-9
pages/reactivity/advanced/on-scope-dispose/on-scope-dispose.test.js
...tivity/advanced/on-scope-dispose/on-scope-dispose.test.js
+2
-0
pages/reactivity/advanced/shallow-reactive/shallow-reactive.test.js
...tivity/advanced/shallow-reactive/shallow-reactive.test.js
+1
-0
pages/reactivity/advanced/shallow-ref/shallow-ref.test.js
pages/reactivity/advanced/shallow-ref/shallow-ref.test.js
+1
-0
pages/reactivity/advanced/trigger-ref/trigger-ref.test.js
pages/reactivity/advanced/trigger-ref/trigger-ref.test.js
+2
-0
pages/reactivity/core/computed/computed.test.js
pages/reactivity/core/computed/computed.test.js
+4
-3
pages/reactivity/core/reactive/reactive.test.js
pages/reactivity/core/reactive/reactive.test.js
+5
-0
pages/reactivity/core/readonly/readonly.test.js
pages/reactivity/core/readonly/readonly.test.js
+1
-0
pages/reactivity/core/ref/ref.test.js
pages/reactivity/core/ref/ref.test.js
+12
-6
pages/reactivity/utilities/to-ref/to-ref.test.js
pages/reactivity/utilities/to-ref/to-ref.test.js
+1
-0
pages/reactivity/utilities/to-refs/to-refs.test.js
pages/reactivity/utilities/to-refs/to-refs.test.js
+1
-0
pages/reactivity/utilities/to-value/to-value.test.js
pages/reactivity/utilities/to-value/to-value.test.js
+6
-5
testSequencer.js
testSequencer.js
+6
-2
未找到文件。
jest.config.js
浏览文件 @
c7e4278c
const
path
=
require
(
'
path
'
)
module
.
exports
=
{
testTimeout
:
1
0000
,
testTimeout
:
2
0000
,
reporters
:
[
'
default
'
],
watchPathIgnorePatterns
:
[
'
/node_modules/
'
,
'
/dist/
'
,
'
/.git/
'
],
moduleFileExtensions
:
[
'
js
'
,
'
json
'
],
rootDir
:
__dirname
,
testMatch
:
[
"
<rootDir>/pages/
App.test.js
"
],
testMatch
:
[
"
<rootDir>/pages/
**/*test.[jt]s?(x)
"
],
testPathIgnorePatterns
:
[
'
/node_modules/
'
],
setupFilesAfterEnv
:
[
'
<rootDir>/jest-setup.js
'
],
testSequencer
:
path
.
join
(
__dirname
,
"
testSequencer.js
"
)
...
...
pages/app-instance/globalProperties/globalProperties.test.js
浏览文件 @
c7e4278c
jest
.
setTimeout
(
2
0000
)
jest
.
setTimeout
(
3
0000
)
const
OPTIONS_PAGE_PATH
=
'
/pages/app-instance/globalProperties/globalProperties-options
'
const
COMPOSITION_PAGE_PATH
=
'
/pages/app-instance/globalProperties/globalProperties-composition
'
...
...
pages/built-in/special-elements/template/template.test.js
浏览文件 @
c7e4278c
...
...
@@ -8,6 +8,7 @@ describe('built-in/special-elements/component', () => {
const
showBtn
=
await
page
.
$
(
'
#show-botton
'
)
expect
(
await
showBtn
.
text
()).
toBe
(
"
点击显示
"
)
await
showBtn
.
tap
()
await
page
.
waitFor
(
500
)
const
dataInfo
=
await
page
.
data
(
'
dataInfo
'
)
expect
(
dataInfo
.
isShow
).
toBeTruthy
()
...
...
pages/component-instance/attrs/attrs.test.js
浏览文件 @
c7e4278c
const
OPTIONS_PAGE_PATH
=
'
/pages/component-instance/attrs/attrs-options
'
const
COMPOSITION_PAGE_PATH
=
'
/pages/component-instance/attrs/attrs-composition
'
describe
(
'
$attrs
'
,
()
=>
{
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isIos
=
platformInfo
.
startsWith
(
'
ios
'
)
describe
(
'
$attrs
'
,
()
=>
{
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
let
page
const
test
=
async
(
page
)
=>
{
const
test
=
async
(
pagePath
)
=>
{
const
page
=
await
program
.
reLaunch
(
pagePath
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
1000
)
const
hasPropsAttr
=
await
page
.
$
(
'
#has-props-attr
'
)
expect
(
await
hasPropsAttr
.
text
()).
toBe
(
'
false
'
)
const
hasEmitsAttr
=
await
page
.
$
(
'
#has-emits-attr
'
)
...
...
@@ -20,16 +20,10 @@ describe('$attrs', () => {
}
it
(
'
$attrs options API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
OPTIONS_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
OPTIONS_PAGE_PATH
)
})
it
(
'
useAttrs composition API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
COMPOSITION_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
COMPOSITION_PAGE_PATH
)
})
})
pages/component-instance/emit-function/emit-function.test.js
浏览文件 @
c7e4278c
...
...
@@ -10,6 +10,7 @@ describe('$emit()', () => {
const
btn
=
await
page
.
$
(
'
.call-parent-btn
'
)
await
btn
.
tap
()
await
page
.
waitFor
(
500
)
const
afterValue
=
await
valueText
.
text
()
expect
(
beforeValue
).
not
.
toBe
(
afterValue
)
...
...
pages/component-instance/force-update/force-update.test.js
浏览文件 @
c7e4278c
...
...
@@ -12,6 +12,7 @@ describe('$forceUpdate', () => {
const
triggerForceUpdateBtn
=
await
page
.
$
(
'
.trigger-force-update-btn
'
)
await
triggerForceUpdateBtn
.
tap
()
await
page
.
waitFor
(
500
)
const
timeText2
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
(
parseInt
(
timeText1
))
...
...
@@ -25,6 +26,7 @@ describe('$forceUpdate', () => {
const
triggerForceUpdateBtn
=
await
page
.
$
(
'
.trigger-force-update-btn
'
)
await
triggerForceUpdateBtn
.
tap
()
await
page
.
waitFor
(
500
)
const
timeText2
=
(
await
timeEl
.
text
()).
replace
(
'
Date.now():
'
,
''
)
expect
(
parseInt
(
timeText2
)).
toBeGreaterThan
(
parseInt
(
timeText1
))
...
...
pages/component-instance/parent/parent.test.js
浏览文件 @
c7e4278c
...
...
@@ -2,8 +2,10 @@ const OPTIONS_PAGE_PATH = '/pages/component-instance/parent/parent-options'
const
COMPOSITION_PAGE_PATH
=
'
/pages/component-instance/parent/parent-composition
'
describe
(
'
$parent
'
,
()
=>
{
let
page
const
test
=
async
(
page
)
=>
{
const
test
=
async
(
pagePath
)
=>
{
page
=
await
program
.
reLaunch
(
pagePath
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
500
)
const
parentStr
=
await
page
.
$
(
'
#parent-str
'
)
expect
(
await
parentStr
.
text
()).
toBe
(
'
parent str
'
)
...
...
@@ -12,20 +14,15 @@ describe('$parent', () => {
const
triggerParentFnBtn
=
await
page
.
$
(
'
#trigger-parent-fn
'
)
await
triggerParentFnBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
parentNum
.
text
()).
toBe
(
'
1
'
)
}
it
(
'
$parent 选项式 API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
OPTIONS_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
OPTIONS_PAGE_PATH
)
});
it
(
'
$parent 组合式 API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
COMPOSITION_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
COMPOSITION_PAGE_PATH
)
})
})
pages/component-instance/props/props.test.js
浏览文件 @
c7e4278c
...
...
@@ -5,8 +5,10 @@ const platformInfo = process.env.uniTestPlatformInfo.toLocaleLowerCase()
const
isAndroid
=
platformInfo
.
includes
(
'
android
'
)
describe
(
'
props
'
,
()
=>
{
let
page
const
test
=
async
(
page
)
=>
{
const
test
=
async
(
pagePath
)
=>
{
page
=
await
program
.
reLaunch
(
pagePath
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
1000
)
const
arrayLiteralStr
=
await
page
.
$
(
'
#array-literal-str
'
)
expect
(
await
arrayLiteralStr
.
text
()).
toBe
(
'
str
'
)
...
...
@@ -50,16 +52,10 @@ describe('props', () => {
}
it
(
'
props 选项式 API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
OPTIONS_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
OPTIONS_PAGE_PATH
)
});
it
(
'
props 组合式 API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
COMPOSITION_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
COMPOSITION_PAGE_PATH
)
})
})
\ No newline at end of file
pages/component-instance/provide/provide-composition.test.js
浏览文件 @
c7e4278c
...
...
@@ -32,6 +32,7 @@ describe('组合式 API provide', () => {
const
checkHasInjectionContextBtn
=
await
page
.
$
(
'
.check-has-injection-context-btn
'
)
await
checkHasInjectionContextBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
hasInjectionContext
.
text
()).
toBe
(
'
hasInjectionContext: false
'
)
})
...
...
pages/component-instance/root/root.test.js
浏览文件 @
c7e4278c
const
OPTIONS_PAGE_PATH
=
'
/pages/component-instance/root/root-options
'
const
COMPOSITION_PAGE_PATH
=
'
/pages/component-instance/root/root-composition
'
describe
(
'
$root
'
,
()
=>
{
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isAndroid
=
platformInfo
.
includes
(
'
android
'
)
const
isIOS
=
platformInfo
.
includes
(
'
ios
'
)
const
isMP
=
platformInfo
.
startsWith
(
'
mp
'
)
describe
(
'
$root
'
,
()
=>
{
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLocaleLowerCase
()
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
if
(
isWeb
)
{
// TODO: web 端 $root 指向和 app 端不同,具体待定
it
(
'
not support
'
,
async
()
=>
{
expect
(
1
).
toBe
(
1
)
})
...
...
@@ -17,6 +15,7 @@ describe('$root', () => {
const
test
=
async
(
pagePath
)
=>
{
page
=
await
program
.
reLaunch
(
pagePath
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
1000
)
const
rootStrParent
=
await
page
.
$
(
'
#root-str-parent
'
)
expect
(
await
rootStrParent
.
text
()).
toBe
(
'
root component str
'
)
...
...
pages/directive/v-if/v-if.test.js
浏览文件 @
c7e4278c
...
...
@@ -2,17 +2,20 @@ const OPTIONS_PAGE_PATH = '/pages/directive/v-if/v-if-options'
const
COMPOSITION_PAGE_PATH
=
'
/pages/directive/v-if/v-if-composition
'
describe
(
'
v-if
'
,
()
=>
{
let
page
const
test
=
async
(
page
)
=>
{
const
test
=
async
(
pagePath
)
=>
{
page
=
await
program
.
reLaunch
(
pagePath
)
await
page
.
waitFor
(
'
view
'
)
let
vIfShow
=
await
page
.
$
(
'
#v-if-show
'
)
expect
(
await
vIfShow
.
text
()).
toBe
(
'
show
'
)
const
switchVIfBtn
=
await
page
.
$
(
'
#switch-v-if-btn
'
)
await
switchVIfBtn
.
tap
()
await
page
.
waitFor
(
500
)
vIfShow
=
await
page
.
$
(
'
#v-if-show
'
)
expect
(
vIfShow
).
toBeNull
()
await
switchVIfBtn
.
tap
()
await
page
.
waitFor
(
500
)
vIfShow
=
await
page
.
$
(
'
#v-if-show
'
)
expect
(
await
vIfShow
.
text
()).
toBe
(
'
show
'
)
...
...
@@ -27,6 +30,7 @@ describe('v-if', () => {
const
changeNumBtn
=
await
page
.
$
(
'
#change-num-btn
'
)
await
changeNumBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
num
.
text
()).
toBe
(
'
2
'
)
numVIf
=
await
page
.
$
(
'
#num-v-if
'
)
...
...
@@ -37,6 +41,7 @@ describe('v-if', () => {
expect
(
numVElse
).
toBeNull
()
await
changeNumBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
num
.
text
()).
toBe
(
'
3
'
)
numVIf
=
await
page
.
$
(
'
#num-v-if
'
)
...
...
@@ -47,6 +52,7 @@ describe('v-if', () => {
expect
(
await
numVElse
.
text
()).
toBe
(
'
v-else
'
)
await
changeNumBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
num
.
text
()).
toBe
(
'
1
'
)
numVIf
=
await
page
.
$
(
'
#num-v-if
'
)
...
...
@@ -58,16 +64,10 @@ describe('v-if', () => {
}
it
(
'
v-if options API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
OPTIONS_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
OPTIONS_PAGE_PATH
)
})
it
(
'
v-if composition API
'
,
async
()
=>
{
page
=
await
program
.
reLaunch
(
COMPOSITION_PAGE_PATH
)
await
page
.
waitFor
(
'
view
'
)
await
test
(
page
)
await
test
(
COMPOSITION_PAGE_PATH
)
})
})
\ No newline at end of file
pages/directive/v-model/v-model-options.test.js
浏览文件 @
c7e4278c
...
...
@@ -7,7 +7,8 @@ describe('v-model', () => {
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
await
page
.
waitFor
(
500
)
await
page
.
waitFor
(
'
view
'
)
await
page
.
waitFor
(
1000
)
})
it
(
'
input
'
,
async
()
=>
{
...
...
@@ -16,7 +17,7 @@ describe('v-model', () => {
const
str
=
await
page
.
$
(
'
#str
'
)
expect
(
await
str
.
text
()).
toBe
(
'
new str
'
)
if
(
!
isIos
)
{
if
(
!
isIos
)
{
// TODO: ios 不支持 number & trim 修饰符
const
modelNumInput
=
await
page
.
$
(
'
#model-num
'
)
await
modelNumInput
.
input
(
'
123
'
)
...
...
@@ -26,11 +27,11 @@ describe('v-model', () => {
const
modelStrTrimInput
=
await
page
.
$
(
'
#model-str-trim
'
)
await
modelStrTrimInput
.
input
(
'
trim
'
)
const
strLength
=
await
page
.
$
(
'
#str-length
'
)
expect
(
await
strLength
.
text
()).
toBe
(
'
4
'
)
const
sonInput
=
await
page
.
$
(
'
#son-input
'
)
expect
(
await
strLength
.
text
()).
toBe
(
'
4
'
)
const
sonInput
=
await
page
.
$
(
'
#son-input
'
)
expect
(
await
sonInput
.
text
()).
toBe
(
'
nested
'
)
}
// TODO: lazy 修饰符仅 android 支持,补充测试
}
// TODO: lazy 修饰符仅 android 支持,补充测试
})
})
\ No newline at end of file
pages/directive/v-on/v-on.test.js
浏览文件 @
c7e4278c
...
...
@@ -17,9 +17,10 @@ describe('v-on', () => {
const
btnList
=
await
page
.
$$
(
'
.btn
'
)
for
(
let
i
=
0
;
i
<
btnList
.
length
;
i
++
)
{
await
btnList
[
i
].
tap
()
}
const
supportedCount
=
isIOS
?
'
7
'
:
isMP
?
'
5
'
:
'
8
'
await
page
.
waitFor
(
500
)
}
const
supportedCount
=
isIOS
?
'
7
'
:
isMP
?
'
5
'
:
'
8
'
expect
(
await
count
.
text
()).
toBe
(
supportedCount
)
...
...
pages/error/throw-error/throw-error.test.js
浏览文件 @
c7e4278c
...
...
@@ -26,6 +26,7 @@ describe('throw error', () => {
const
triggerErrorBtn
=
await
page
.
$
(
'
#trigger-error
'
)
await
triggerErrorBtn
.
tap
()
await
page
.
waitFor
(
500
)
lifeCycleNum
=
await
page
.
callMethod
(
'
getLifeCycleNum
'
)
expect
(
lifeCycleNum
).
toBe
(
200
)
...
...
pages/examples/nested-component-communication/nested-component-communication.test.js
浏览文件 @
c7e4278c
...
...
@@ -18,18 +18,21 @@ describe('built-in/component', () => {
expect
(
await
grandChildElement
.
text
()).
toEqual
(
'
0
'
)
await
parentBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
parentMsgElement
.
text
()).
toEqual
(
'
1
'
)
expect
(
await
childMsgElement
.
text
()).
toEqual
(
'
1
'
)
expect
(
await
grandChildElement
.
text
()).
toEqual
(
'
1
'
)
await
parentBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
parentMsgElement
.
text
()).
toEqual
(
'
2
'
)
expect
(
await
childMsgElement
.
text
()).
toEqual
(
'
2
'
)
expect
(
await
grandChildElement
.
text
()).
toEqual
(
'
2
'
)
await
grandChildBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
parentMsgElement
.
text
()).
toEqual
(
'
0
'
)
expect
(
await
childMsgElement
.
text
()).
toEqual
(
'
0
'
)
...
...
pages/reactivity/advanced/effect-scope/effect-scope.test.js
浏览文件 @
c7e4278c
const
PAGE_PATH
=
'
/pages/reactivity/advanced/effect-scope/effect-scope
'
describe
(
'
effectScope
'
,
()
=>
{
let
page
=
null
let
page
=
null
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
()
const
isAndroid
=
platformInfo
.
startsWith
(
'
android
'
)
const
isIos
=
platformInfo
.
startsWith
(
'
ios
'
)
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
beforeAll
(
async
()
=>
{
page
=
await
program
.
reLaunch
(
PAGE_PATH
)
...
...
@@ -15,12 +15,12 @@ describe('effectScope', () => {
const
counter
=
await
page
.
$
(
'
#counter
'
)
expect
(
await
counter
.
text
()).
toBe
(
'
0
'
)
const
watchCounterRes
=
await
page
.
$
(
'
#watch-counter-res
'
)
if
(
isAndroid
||
isWeb
){
expect
(
await
watchCounterRes
.
text
()).
toBe
(
''
)
}
if
(
isIos
){
expect
(
await
watchCounterRes
.
text
()).
toBe
(
null
)
const
watchCounterRes
=
await
page
.
$
(
'
#watch-counter-res
'
)
if
(
isAndroid
||
isWeb
){
expect
(
await
watchCounterRes
.
text
()).
toBe
(
''
)
}
if
(
isIos
){
expect
(
await
watchCounterRes
.
text
()).
toBe
(
null
)
}
const
watchEffectCounterRes
=
await
page
.
$
(
'
#watch-effect-counter-res
'
)
...
...
@@ -28,6 +28,7 @@ describe('effectScope', () => {
const
incrementCounterBtn
=
await
page
.
$
(
'
#increment-counter-btn
'
)
await
incrementCounterBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
counter
.
text
()).
toBe
(
'
1
'
)
expect
(
await
watchCounterRes
.
text
()).
toBe
(
'
newVal: 1, oldVal: 0
'
)
...
...
@@ -35,8 +36,8 @@ describe('effectScope', () => {
const
stopEffectScopeBtn
=
await
page
.
$
(
'
#stop-effect-scope-btn
'
)
await
stopEffectScopeBtn
.
tap
()
await
incrementCounterBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
counter
.
text
()).
toBe
(
'
2
'
)
expect
(
await
watchCounterRes
.
text
()).
toBe
(
'
newVal: 1, oldVal: 0
'
)
...
...
pages/reactivity/advanced/on-scope-dispose/on-scope-dispose.test.js
浏览文件 @
c7e4278c
...
...
@@ -12,11 +12,13 @@ describe('onScopeDispose', () => {
const
createScopeBtn
=
await
page
.
$
(
'
#create-scope-btn
'
)
await
createScopeBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
hasCurrentScope
.
text
()).
toBe
(
'
true
'
)
const
stopScopeBtn
=
await
page
.
$
(
'
#stop-scope-btn
'
)
await
stopScopeBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
hasCurrentScope
.
text
()).
toBe
(
'
false
'
)
})
...
...
pages/reactivity/advanced/shallow-reactive/shallow-reactive.test.js
浏览文件 @
c7e4278c
...
...
@@ -22,6 +22,7 @@ describe('shallowReactive', () => {
const
incrementStateCountBtn
=
await
page
.
$
(
'
#increment-state-count-btn
'
)
await
incrementStateCountBtn
.
tap
()
await
page
.
waitFor
(
500
)
if
(
isWeb
)
{
// web 端 view text 为组件,无法动态更新 shallowReactive nested 数据
...
...
pages/reactivity/advanced/shallow-ref/shallow-ref.test.js
浏览文件 @
c7e4278c
...
...
@@ -17,6 +17,7 @@ describe('shallowRef', () => {
const
updateStateBtn
=
await
page
.
$
(
'
#update-state-btn
'
)
await
updateStateBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
stateCount
.
text
()).
toBe
(
'
1
'
)
})
...
...
pages/reactivity/advanced/trigger-ref/trigger-ref.test.js
浏览文件 @
c7e4278c
...
...
@@ -12,11 +12,13 @@ describe('triggerRef', () => {
const
incrementStateCountBtn
=
await
page
.
$
(
'
#increment-state-count-btn
'
)
await
incrementStateCountBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
stateCount
.
text
()).
toBe
(
'
0
'
)
const
triggerRefStateBtn
=
await
page
.
$
(
'
#trigger-ref-state-btn
'
)
await
triggerRefStateBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
stateCount
.
text
()).
toBe
(
'
1
'
)
})
...
...
pages/reactivity/core/computed/computed.test.js
浏览文件 @
c7e4278c
...
...
@@ -13,13 +13,14 @@ describe('computed', () => {
const
objArr
=
await
page
.
$
(
'
#obj-arr
'
)
expect
(
await
objArr
.
text
()).
toBe
(
'
[1,2,3]
'
)
const
objArrLen
=
await
page
.
$
(
'
#obj-arr-len
'
)
expect
(
await
objArrLen
.
text
()).
toBe
(
'
3
'
)
const
computedWithArgument
=
await
page
.
$
(
'
#computed-with-argument
'
)
expect
(
await
objArrLen
.
text
()).
toBe
(
'
3
'
)
const
computedWithArgument
=
await
page
.
$
(
'
#computed-with-argument
'
)
expect
(
await
computedWithArgument
.
text
()).
toBe
(
'
审核中
'
)
const
updateBtn
=
await
page
.
$
(
'
#update-btn
'
)
await
updateBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
count
.
text
()).
toBe
(
'
1
'
)
expect
(
await
doubleCount
.
text
()).
toBe
(
'
2
'
)
...
...
pages/reactivity/core/reactive/reactive.test.js
浏览文件 @
c7e4278c
...
...
@@ -24,19 +24,23 @@ describe('reactive', () => {
const
updateCountBtn
=
await
page
.
$
(
'
#update-count-btn
'
)
await
updateCountBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
count
.
text
()).
toBe
(
'
1
'
)
const
updateObjStrBtn
=
await
page
.
$
(
'
#update-obj-str-btn
'
)
await
updateObjStrBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
objStr
.
text
()).
toBe
(
'
new str
'
)
const
updateObjNumBtn
=
await
page
.
$
(
'
#update-obj-num-btn
'
)
await
updateObjNumBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
count
.
text
()).
toBe
(
'
2
'
)
expect
(
await
objNum
.
text
()).
toBe
(
'
2
'
)
const
updateObjArrBtn
=
await
page
.
$
(
'
#update-obj-arr-btn
'
)
await
updateObjArrBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
objArr
.
text
()).
toBe
(
'
["a","b","c","d"]
'
)
const
count1
=
await
page
.
$
(
'
#count1
'
)
...
...
@@ -48,6 +52,7 @@ describe('reactive', () => {
const
updateArr1Btn
=
await
page
.
$
(
'
#update-arr1-btn
'
)
await
updateArr1Btn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
arr1
.
text
()).
toBe
(
JSON
.
stringify
([
1
,
2
,
3
]))
const
updateArr1ReactiveBtn
=
await
page
.
$
(
'
#update-arr1-reactive-btn
'
)
...
...
pages/reactivity/core/readonly/readonly.test.js
浏览文件 @
c7e4278c
...
...
@@ -23,6 +23,7 @@ describe('ref', () => {
const
updateDataBtn
=
await
page
.
$
(
'
#update-data-btn
'
)
await
updateDataBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
dataStr
.
text
()).
toBe
(
'
new str
'
)
expect
(
await
dataNum
.
text
()).
toBe
(
'
1
'
)
...
...
pages/reactivity/core/ref/ref.test.js
浏览文件 @
c7e4278c
...
...
@@ -16,32 +16,38 @@ describe('ref', () => {
const
arr
=
await
page
.
$
(
'
#arr
'
)
expect
(
await
arr
.
text
()).
toBe
(
'
[1,2,3]
'
)
const
counterCount
=
await
page
.
$
(
'
#counter-count
'
)
expect
(
await
counterCount
.
text
()).
toBe
(
'
0
'
)
const
countersCount
=
await
page
.
$
(
'
#counters-count
'
)
expect
(
await
counterCount
.
text
()).
toBe
(
'
0
'
)
const
countersCount
=
await
page
.
$
(
'
#counters-count
'
)
expect
(
await
countersCount
.
text
()).
toBe
(
'
0
'
)
const
changeCountBtn
=
await
page
.
$
(
'
#change-count-btn
'
)
await
changeCountBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
count
.
text
()).
toBe
(
'
1
'
)
const
changeStrBtn
=
await
page
.
$
(
'
#change-str-btn
'
)
await
changeStrBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
str
.
text
()).
toBe
(
'
new str
'
)
const
changeBoolBtn
=
await
page
.
$
(
'
#change-bool-btn
'
)
await
changeBoolBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
bool
.
text
()).
toBe
(
'
true
'
)
const
changeArrBtn
=
await
page
.
$
(
'
#change-arr-btn
'
)
await
changeArrBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
arr
.
text
()).
toBe
(
'
[1,2,3,4]
'
)
const
changeCounterBtn
=
await
page
.
$
(
'
#change-counter-btn
'
)
await
changeCounterBtn
.
tap
()
expect
(
await
counterCount
.
text
()).
toBe
(
'
1
'
)
const
changeCountersBtn
=
await
page
.
$
(
'
#change-counters-btn
'
)
await
changeCountersBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
counterCount
.
text
()).
toBe
(
'
1
'
)
const
changeCountersBtn
=
await
page
.
$
(
'
#change-counters-btn
'
)
await
changeCountersBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
countersCount
.
text
()).
toBe
(
'
1
'
)
})
...
...
pages/reactivity/utilities/to-ref/to-ref.test.js
浏览文件 @
c7e4278c
...
...
@@ -25,6 +25,7 @@ describe('toRef', () => {
const
incrementBtn
=
await
page
.
$
(
'
#increment-btn
'
)
await
incrementBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
objNum
.
text
()).
toBe
(
'
2
'
)
expect
(
await
toRefObjNum
.
text
()).
toBe
(
'
2
'
)
...
...
pages/reactivity/utilities/to-refs/to-refs.test.js
浏览文件 @
c7e4278c
...
...
@@ -25,6 +25,7 @@ describe('toRefs', () => {
const
updateStateBtn
=
await
page
.
$
(
'
#update-state-btn
'
)
await
updateStateBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
stateNum
.
text
()).
toBe
(
'
1
'
)
expect
(
await
stateStr
.
text
()).
toBe
(
'
str-1
'
)
...
...
pages/reactivity/utilities/to-value/to-value.test.js
浏览文件 @
c7e4278c
const
PAGE_PATH
=
'
/pages/reactivity/utilities/to-value/to-value
'
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
()
const
PAGE_PATH
=
'
/pages/reactivity/utilities/to-value/to-value
'
const
platformInfo
=
process
.
env
.
uniTestPlatformInfo
.
toLowerCase
()
const
isWeb
=
platformInfo
.
startsWith
(
'
web
'
)
describe
(
'
toValue
'
,
()
=>
{
...
...
@@ -25,10 +25,11 @@ describe('toValue', () => {
const
incrementBtn
=
await
page
.
$
(
'
#increment-btn
'
)
await
incrementBtn
.
tap
()
await
page
.
waitFor
(
500
)
expect
(
await
objNum
.
text
()).
toBe
(
'
1
'
)
if
(
!
isWeb
){
// 数据更新成功,但因为 web 端 text 为组件,所以视图未更新
expect
(
await
objNum
.
text
()).
toBe
(
'
1
'
)
if
(
!
isWeb
){
// 数据更新成功,但因为 web 端 text 为组件,所以视图未更新
expect
(
await
toValueObjNum
.
text
()).
toBe
(
'
1
'
)
}
})
...
...
testSequencer.js
浏览文件 @
c7e4278c
...
...
@@ -8,7 +8,6 @@ const endTestFilePaths = [
]
class
CustomSequencer
extends
Sequencer
{
sort
(
tests
)
{
// 测试例排序
const
startTests
=
startTestFilePaths
.
map
((
filePath
)
=>
{
return
tests
.
find
((
test
)
=>
test
.
path
.
endsWith
(
filePath
))
...
...
@@ -19,7 +18,12 @@ class CustomSequencer extends Sequencer {
return
tests
.
find
((
test
)
=>
test
.
path
.
endsWith
(
filePath
))
})
.
filter
(
Boolean
)
return
[...
new
Set
([...
startTests
,
...
tests
,
...
endTests
])]
const
middleTests
=
tests
.
filter
((
test
)
=>
!
startTests
.
includes
(
test
)
&&
!
endTests
.
includes
(
test
)
);
return
[...
startTests
,
...
middleTests
,
...
endTests
]
}
}
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录