Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
a9b41a60
H
hello uni-app x
项目概览
DCloud
/
hello uni-app x
通知
5992
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看板
提交
a9b41a60
编写于
5月 31, 2024
作者:
辛宝Otto
🥊
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 补充 checkbox iconColor/foreColor 相关测试
上级
85446a1d
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
36 addition
and
12 deletion
+36
-12
pages/component/checkbox/checkbox.test.js
pages/component/checkbox/checkbox.test.js
+18
-1
pages/component/checkbox/checkbox.uvue
pages/component/checkbox/checkbox.uvue
+18
-11
未找到文件。
pages/component/checkbox/checkbox.test.js
浏览文件 @
a9b41a60
...
@@ -67,6 +67,23 @@ describe('Checkbox.uvue', () => {
...
@@ -67,6 +67,23 @@ describe('Checkbox.uvue', () => {
})
})
expect
(
await
cb
.
attribute
(
'
color
'
)).
toBe
(
'
#63acfc
'
)
expect
(
await
cb
.
attribute
(
'
color
'
)).
toBe
(
'
#63acfc
'
)
})
})
it
(
'
icon color
'
,
async
()
=>
{
const
cb
=
await
page
.
$
(
'
.cb
'
)
expect
(
await
cb
.
attribute
(
'
iconColor
'
)).
toBe
(
'
#211cfe
'
)
await
page
.
setData
({
iconColor
:
'
#63acfc
'
,
})
expect
(
await
cb
.
attribute
(
'
iconColor
'
)).
toBe
(
'
#63acfc
'
)
})
it
(
'
foreColor
'
,
async
()
=>
{
const
cb
=
await
page
.
$
(
'
.cb
'
)
expect
(
await
cb
.
attribute
(
'
foreColor
'
)).
toBe
(
'
#ff0000
'
)
await
page
.
setData
({
foreColor
:
'
#63acfe
'
,
})
expect
(
await
cb
.
attribute
(
'
foreColor
'
)).
toBe
(
'
#63acfe
'
)
})
it
(
'
disabled
'
,
async
()
=>
{
it
(
'
disabled
'
,
async
()
=>
{
const
cb
=
await
page
.
$
(
'
.cb2
'
)
const
cb
=
await
page
.
$
(
'
.cb2
'
)
expect
(
await
cb
.
attribute
(
'
disabled
'
)).
toBe
(
true
+
''
)
expect
(
await
cb
.
attribute
(
'
disabled
'
)).
toBe
(
true
+
''
)
...
@@ -78,7 +95,7 @@ describe('Checkbox.uvue', () => {
...
@@ -78,7 +95,7 @@ describe('Checkbox.uvue', () => {
it
(
'
trigger UniCheckboxGroupChangeEvent
'
,
async
()
=>
{
it
(
'
trigger UniCheckboxGroupChangeEvent
'
,
async
()
=>
{
const
element
=
await
page
.
$
(
'
.checkbox-item-0
'
)
const
element
=
await
page
.
$
(
'
.checkbox-item-0
'
)
await
element
.
tap
()
await
element
.
tap
()
await
page
.
waitFor
(
5
00
)
await
page
.
waitFor
(
10
00
)
const
eventCallbackNum
=
await
page
.
callMethod
(
'
getEventCallbackNum
'
)
const
eventCallbackNum
=
await
page
.
callMethod
(
'
getEventCallbackNum
'
)
expect
(
eventCallbackNum
-
originEventCallbackNum
).
toBe
(
3
)
expect
(
eventCallbackNum
-
originEventCallbackNum
).
toBe
(
3
)
})
})
...
...
pages/component/checkbox/checkbox.uvue
浏览文件 @
a9b41a60
...
@@ -46,7 +46,9 @@
...
@@ -46,7 +46,9 @@
value: [] as string[],
value: [] as string[],
disabled: true,
disabled: true,
checked: true,
checked: true,
color: '#007aff',
color: '#007aff',
iconColor:'#211cfe',
foreColor:'#ff0000',
// 组件属性 autotest
// 组件属性 autotest
checked_boolean: false,
checked_boolean: false,
disabled_boolean: false,
disabled_boolean: false,
...
@@ -55,7 +57,8 @@
...
@@ -55,7 +57,8 @@
borderColor_input: "#d1d1d1",
borderColor_input: "#d1d1d1",
activeBackgroundColor_input: "#ffffff",
activeBackgroundColor_input: "#ffffff",
activeBorderColor_input: "#d1d1d1",
activeBorderColor_input: "#d1d1d1",
iconColor_input: "#007aff"
iconColor_input: "#007aff",
foreColor_input: '#ff0000'
}
}
},
},
methods: {
methods: {
...
@@ -70,7 +73,7 @@
...
@@ -70,7 +73,7 @@
},
},
checkboxChange: function (e : UniCheckboxGroupChangeEvent) {
checkboxChange: function (e : UniCheckboxGroupChangeEvent) {
// 自动化测试
// 自动化测试
if ((e.target?.tagName ?? '')
.includes('CHECKBOX-GROUP')
) {
if ((e.target?.tagName ?? '')
== 'CHECKBOX-GROUP'
) {
this.setEventCallbackNum(state.eventCallbackNum + 1)
this.setEventCallbackNum(state.eventCallbackNum + 1)
}
}
if (e.type === 'change') {
if (e.type === 'change') {
...
@@ -105,19 +108,20 @@
...
@@ -105,19 +108,20 @@
confirm_borderColor_input(value : string) { this.borderColor_input = value },
confirm_borderColor_input(value : string) { this.borderColor_input = value },
confirm_activeBackgroundColor_input(value : string) { this.activeBackgroundColor_input = value },
confirm_activeBackgroundColor_input(value : string) { this.activeBackgroundColor_input = value },
confirm_activeBorderColor_input(value : string) { this.activeBorderColor_input = value },
confirm_activeBorderColor_input(value : string) { this.activeBorderColor_input = value },
confirm_iconColor_input(value : string) { this.iconColor_input = value }
confirm_iconColor_input(value : string) { this.iconColor_input = value },
confirm_foreColor_input(value : string) { this.foreColor_input = value }
}
}
}
}
</script>
</script>
<template>
<template>
<view class="main">
<view class="main">
<checkbox :disabled="disabled_boolean" :checked="checked_boolean" :color="color_input"
<checkbox :disabled="disabled_boolean" :checked="checked_boolean" :color="color_input"
:iconColor="iconColor_input"
:backgroundColor="backgroundColor_input" :borderColor="borderColor_input"
:
foreColor="foreColor_input" :
backgroundColor="backgroundColor_input" :borderColor="borderColor_input"
:activeBackgroundColor="activeBackgroundColor_input" :activeBorderColor="activeBorderColor_input"
:activeBackgroundColor="activeBackgroundColor_input" :activeBorderColor="activeBorderColor_input"
:iconColor="iconColor_input" @click="checkbox_click" @touchstart="checkbox_touchstart
"
@click="checkbox_click" @touchstart="checkbox_touchstart" @touchmove="checkbox_touchmove
"
@touch
move="checkbox_touchmove" @touchcancel="checkbox_touchcancel" @touchend="checkbox_touchend
"
@touch
cancel="checkbox_touchcancel" @touchend="checkbox_touchend" @tap="checkbox_tap
"
@
tap="checkbox_tap" @
longpress="checkbox_longpress"><text>uni-app-x</text></checkbox>
@longpress="checkbox_longpress"><text>uni-app-x</text></checkbox>
</view>
</view>
<scroll-view style="flex: 1">
<scroll-view style="flex: 1">
...
@@ -134,8 +138,10 @@
...
@@ -134,8 +138,10 @@
@confirm="confirm_activeBackgroundColor_input"></input-data>
@confirm="confirm_activeBackgroundColor_input"></input-data>
<input-data defaultValue="#d1d1d1" title="checkbox选中时的边框颜色" type="text"
<input-data defaultValue="#d1d1d1" title="checkbox选中时的边框颜色" type="text"
@confirm="confirm_activeBorderColor_input"></input-data>
@confirm="confirm_activeBorderColor_input"></input-data>
<input-data defaultValue="#007aff" title="checkbox的图标颜色,优先级大于color属性" type="text"
<input-data defaultValue="#007aff" title="
iconColor:
checkbox的图标颜色,优先级大于color属性" type="text"
@confirm="confirm_iconColor_input"></input-data>
@confirm="confirm_iconColor_input"></input-data>
<input-data defaultValue="#ff0000" title="foreColor: checkbox的图标颜色,优先级大于color属性" type="text"
@confirm="confirm_foreColor_input"></input-data>
</view>
</view>
<view>
<view>
...
@@ -146,7 +152,8 @@
...
@@ -146,7 +152,8 @@
</view>
</view>
<view>
<view>
<checkbox-group class="uni-flex uni-row checkbox-group" @change="testChange" style="flex-wrap: wrap">
<checkbox-group class="uni-flex uni-row checkbox-group" @change="testChange" style="flex-wrap: wrap">
<checkbox value="cb" :checked="checked" :color="color" style="margin-right: 15px" class="checkbox cb">选中
<checkbox value="cb" :checked="checked" :color="color" :iconColor="iconColor"
:foreColor="foreColor" style="margin-right: 15px" class="checkbox cb">选中
</checkbox>
</checkbox>
<checkbox value="cb1" style="margin-right: 15px" class="checkbox cb1">{{ text }}</checkbox>
<checkbox value="cb1" style="margin-right: 15px" class="checkbox cb1">{{ text }}</checkbox>
<checkbox value="cb2" :disabled="disabled" class="checkbox cb2">禁用</checkbox>
<checkbox value="cb2" :disabled="disabled" class="checkbox cb2">禁用</checkbox>
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录