Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
DCloud
hello uni-app x
提交
84359b8c
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看板
提交
84359b8c
编写于
11月 01, 2023
作者:
DCloud-WZF
💬
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
test: 优化 setNavigationBarColor 测试例
上级
e9385585
变更
4
显示空白变更内容
内联
并排
Showing
4 changed file
with
38 addition
and
27 deletion
+38
-27
pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js
...igation-bar-color/set-custom-navigation-bar-color.test.js
+4
-0
pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.uvue
...navigation-bar-color/set-custom-navigation-bar-color.uvue
+10
-4
pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js
...set-navigation-bar-color/set-navigation-bar-color.test.js
+14
-10
pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue
...PI/set-navigation-bar-color/set-navigation-bar-color.uvue
+10
-13
未找到文件。
pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.test.js
浏览文件 @
84359b8c
...
@@ -24,6 +24,8 @@ describe("setCustomNavigationBarColor", () => {
...
@@ -24,6 +24,8 @@ describe("setCustomNavigationBarColor", () => {
area
:
{
x
:
880
,
y
:
0
,
width
:
100
,
height
:
60
},
area
:
{
x
:
880
,
y
:
0
,
width
:
100
,
height
:
60
},
});
});
expect
(
image
).
toMatchImageSnapshot
();
expect
(
image
).
toMatchImageSnapshot
();
const
lifeCycleNum
=
await
page
.
callMethod
(
"
getLifeCycleNum
"
);
expect
(
lifeCycleNum
-
originLifeCycleNum
).
toBe
(
2
);
});
});
it
(
"
setNavigationBarColor1
"
,
async
()
=>
{
it
(
"
setNavigationBarColor1
"
,
async
()
=>
{
...
@@ -34,5 +36,7 @@ describe("setCustomNavigationBarColor", () => {
...
@@ -34,5 +36,7 @@ describe("setCustomNavigationBarColor", () => {
area
:
{
x
:
880
,
y
:
0
,
width
:
100
,
height
:
60
},
area
:
{
x
:
880
,
y
:
0
,
width
:
100
,
height
:
60
},
});
});
expect
(
image
).
toMatchImageSnapshot
();
expect
(
image
).
toMatchImageSnapshot
();
const
lifeCycleNum
=
await
page
.
callMethod
(
"
getLifeCycleNum
"
);
expect
(
lifeCycleNum
-
originLifeCycleNum
).
toBe
(
4
);
});
});
});
});
pages/API/set-navigation-bar-color/set-custom-navigation-bar-color.uvue
浏览文件 @
84359b8c
...
@@ -50,12 +50,15 @@ export default {
...
@@ -50,12 +50,15 @@ export default {
success() {
success() {
this.navigationBarTextColor = '#fff'
this.navigationBarTextColor = '#fff'
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
},
fail() {
fail() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
},
complete() {
complete() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
}
})
})
},
},
...
@@ -66,12 +69,15 @@ export default {
...
@@ -66,12 +69,15 @@ export default {
success() {
success() {
this.navigationBarTextColor = '#000'
this.navigationBarTextColor = '#000'
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
},
fail() {
fail() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
},
complete() {
complete() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
}
})
})
},
},
...
...
pages/API/set-navigation-bar-color/set-navigation-bar-color.test.js
浏览文件 @
84359b8c
...
@@ -16,14 +16,18 @@ describe('setNavigationBarColor', () => {
...
@@ -16,14 +16,18 @@ describe('setNavigationBarColor', () => {
expect
(
lifeCycleNum
).
toBe
(
originLifeCycleNum
)
expect
(
lifeCycleNum
).
toBe
(
originLifeCycleNum
)
})
})
it
(
'
setNavigationBarColor1
'
,
async
()
=>
{
it
(
"
setNavigationBarColor1
"
,
async
()
=>
{
await
page
.
callMethod
(
'
setNavigationBarColor1
'
)
await
page
.
callMethod
(
"
setNavigationBarColor1
"
);
const
image
=
await
program
.
screenshot
()
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
()
expect
(
image
).
toMatchImageSnapshot
();
})
const
lifeCycleNum
=
await
page
.
callMethod
(
"
getLifeCycleNum
"
);
it
(
'
setNavigationBarColor2
'
,
async
()
=>
{
expect
(
lifeCycleNum
-
originLifeCycleNum
).
toBe
(
2
);
await
page
.
callMethod
(
'
setNavigationBarColor2
'
)
});
const
image
=
await
program
.
screenshot
()
it
(
"
setNavigationBarColor2
"
,
async
()
=>
{
expect
(
image
).
toMatchImageSnapshot
()
await
page
.
callMethod
(
"
setNavigationBarColor2
"
);
})
const
image
=
await
program
.
screenshot
();
expect
(
image
).
toMatchImageSnapshot
();
const
lifeCycleNum
=
await
page
.
callMethod
(
"
getLifeCycleNum
"
);
expect
(
lifeCycleNum
-
originLifeCycleNum
).
toBe
(
4
);
});
})
})
pages/API/set-navigation-bar-color/set-navigation-bar-color.uvue
浏览文件 @
84359b8c
...
@@ -26,12 +26,15 @@ export default {
...
@@ -26,12 +26,15 @@ export default {
backgroundColor: '#00ff00',
backgroundColor: '#00ff00',
success() {
success() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
},
fail() {
fail() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
},
complete() {
complete() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
}
})
})
},
},
...
@@ -41,12 +44,15 @@ export default {
...
@@ -41,12 +44,15 @@ export default {
backgroundColor: '#ff0000',
backgroundColor: '#ff0000',
success() {
success() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor success')
this.setLifeCycleNum(state.lifeCycleNum + 1)
},
},
fail() {
fail() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor fail')
this.setLifeCycleNum(state.lifeCycleNum - 1)
},
},
complete() {
complete() {
console.log('setNavigationBarColor success')
console.log('setNavigationBarColor complete')
this.setLifeCycleNum(state.lifeCycleNum + 1)
}
}
})
})
},
},
...
@@ -66,12 +72,3 @@ export default {
...
@@ -66,12 +72,3 @@ export default {
},
},
}
}
</script>
</script>
<style>
.direction-row {
flex-direction: row;
}
.label {
width: 190px;
}
</style>
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录