Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
6fb95d25
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5995
Star
90
Fork
162
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
18
列表
看板
标记
里程碑
合并请求
1
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
H
hello uni-app x
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
18
Issue
18
列表
看板
标记
里程碑
合并请求
1
合并请求
1
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
6fb95d25
编写于
5月 04, 2024
作者:
W
wanganxp
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
补充form和拦截器的测试
上级
fee5e34d
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
14 addition
and
2 deletion
+14
-2
pages/API/interceptor/interceptor.uvue
pages/API/interceptor/interceptor.uvue
+2
-1
pages/component/form/form.test.js
pages/component/form/form.test.js
+6
-1
pages/component/form/form.uvue
pages/component/form/form.uvue
+6
-0
未找到文件。
pages/API/interceptor/interceptor.uvue
浏览文件 @
6fb95d25
...
@@ -3,7 +3,8 @@
...
@@ -3,7 +3,8 @@
<button @click="addInterceptor">添加路由拦截器</button>
<button @click="addInterceptor">添加路由拦截器</button>
<button @click="removeInterceptor">移除路由拦截器</button>
<button @click="removeInterceptor">移除路由拦截器</button>
<text>点击下方按钮{{msg}}</text>
<text>点击下方按钮{{msg}}</text>
<button @click="navigateTo">跳转到测试页面</button>
<button @click="navigateTo">navigatorTo API跳转到测试页面</button>
<navigator url="./page1"><button>navigator组件跳转到测试页面</button></navigator>
</view>
</view>
</template>
</template>
...
...
pages/component/form/form.test.js
浏览文件 @
6fb95d25
...
@@ -5,12 +5,14 @@ const DEFAULT_GENDER = '0'
...
@@ -5,12 +5,14 @@ const DEFAULT_GENDER = '0'
const
DEFAULT_LOVES
=
[
'
0
'
]
const
DEFAULT_LOVES
=
[
'
0
'
]
const
DEFAULT_AGE
=
18
const
DEFAULT_AGE
=
18
const
DEFAULT_SWITCH
=
true
const
DEFAULT_SWITCH
=
true
const
DEFAULT_COMMENT
=
''
const
CHANGE_NICK_NAME
=
'
hello
'
const
CHANGE_NICK_NAME
=
'
hello
'
const
CHANGE_GENDER
=
'
1
'
const
CHANGE_GENDER
=
'
1
'
const
CHANGE_LOVES
=
[
'
0
'
,
'
1
'
]
const
CHANGE_LOVES
=
[
'
0
'
,
'
1
'
]
const
CHANGE_AGE
=
50
const
CHANGE_AGE
=
50
const
CHANGE_SWITCH
=
false
const
CHANGE_SWITCH
=
false
const
CHANGE_COMMENT
=
'
备注
'
describe
(
'
form
'
,
()
=>
{
describe
(
'
form
'
,
()
=>
{
let
page
let
page
...
@@ -35,6 +37,7 @@ describe('form', () => {
...
@@ -35,6 +37,7 @@ describe('form', () => {
expect
(
formData
[
'
loves
'
][
1
]).
toBe
(
CHANGE_LOVES
[
1
])
expect
(
formData
[
'
loves
'
][
1
]).
toBe
(
CHANGE_LOVES
[
1
])
expect
(
formData
[
'
age
'
]).
toBe
(
CHANGE_AGE
)
expect
(
formData
[
'
age
'
]).
toBe
(
CHANGE_AGE
)
expect
(
formData
[
'
switch
'
]).
toBe
(
CHANGE_SWITCH
)
expect
(
formData
[
'
switch
'
]).
toBe
(
CHANGE_SWITCH
)
expect
(
formData
[
'
comment
'
]).
toBe
(
CHANGE_COMMENT
)
})
})
it
(
'
reset
'
,
async
()
=>
{
it
(
'
reset
'
,
async
()
=>
{
await
changeData
(
page
)
await
changeData
(
page
)
...
@@ -56,6 +59,7 @@ describe('form', () => {
...
@@ -56,6 +59,7 @@ describe('form', () => {
expect
(
formData
[
'
loves
'
][
0
]).
toBe
(
DEFAULT_LOVES
[
0
])
expect
(
formData
[
'
loves
'
][
0
]).
toBe
(
DEFAULT_LOVES
[
0
])
expect
(
formData
[
'
age
'
]).
toBe
(
DEFAULT_AGE
)
expect
(
formData
[
'
age
'
]).
toBe
(
DEFAULT_AGE
)
expect
(
formData
[
'
switch
'
]).
toBe
(
DEFAULT_SWITCH
)
expect
(
formData
[
'
switch
'
]).
toBe
(
DEFAULT_SWITCH
)
expect
(
formData
[
'
comment
'
]).
toBe
(
DEFAULT_COMMENT
)
})
})
})
})
...
@@ -65,7 +69,8 @@ async function changeData(page) {
...
@@ -65,7 +69,8 @@ async function changeData(page) {
gender
:
CHANGE_GENDER
,
gender
:
CHANGE_GENDER
,
loves
:
CHANGE_LOVES
,
loves
:
CHANGE_LOVES
,
age
:
CHANGE_AGE
,
age
:
CHANGE_AGE
,
switch
:
CHANGE_SWITCH
switch
:
CHANGE_SWITCH
,
comment
:
CHANGE_COMMENT
})
})
await
page
.
waitFor
(
100
)
await
page
.
waitFor
(
100
)
}
}
pages/component/form/form.uvue
浏览文件 @
6fb95d25
...
@@ -40,6 +40,11 @@
...
@@ -40,6 +40,11 @@
<switch name="switch" :checked="switch" />
<switch name="switch" :checked="switch" />
</view>
</view>
</view>
</view>
<view class="uni-form-item">
<view class="title">备注</view>
<textarea name="comment" :value="comment" placeholder="请输入备注" style="background: #FFF;"/>
<!-- <textarea class="uni-input" name="comment" :value="comment" placeholder="这个class的写法,导致iOS和Android产生了高度差异"/> -->
</view>
<view class="uni-btn-v flex-row">
<view class="uni-btn-v flex-row">
<button class="btn btn-submit" form-type="submit" type="primary">Submit</button>
<button class="btn btn-submit" form-type="submit" type="primary">Submit</button>
<button class="btn btn-reset" type="default" form-type="reset">Reset</button>
<button class="btn btn-reset" type="default" form-type="reset">Reset</button>
...
@@ -62,6 +67,7 @@
...
@@ -62,6 +67,7 @@
age: 18,
age: 18,
loves: ['0'],
loves: ['0'],
switch: true,
switch: true,
comment:'',
formData: {} as UTSJSONObject
formData: {} as UTSJSONObject
}
}
},
},
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录