提交 498489d8 编写于 作者: DCloud_iOS_XHY's avatar DCloud_iOS_XHY

添加设置页面容器背景色测试例

上级 834cb665
......@@ -396,6 +396,12 @@
"navigationBarTitleText": "设置导航条标题"
}
},
{
"path": "pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent",
"style": {
"navigationBarTitleText": "设置页面容器背景色"
}
},
{
"path": "pages/API/navigator/new-page/new-page-1",
"style": {
......
describe('set-page-backgroundColorContent', () => {
let page
beforeAll(async () => {
page = await program.reLaunch('/pages/API/set-page-backgroundColorContent/set-page-backgroundColorContent')
await page.waitFor(600);
})
it('check_backgroundColorContent_red', async () => {
await page.callMethod('changeColor', "")
page.waitFor(100)
const image = await program.screenshot({fullPage: true});
expect(image).toSaveImageSnapshot();
})
})
<template>
<view class="container" @click="changeColor">
<text>点击切换页面容器颜色</text>
</view>
</template>
<script>
export default {
data() {
return {
isChange : false
}
},
methods: {
changeColor() {
let pages = getCurrentPages()
let page = pages[pages.length - 1]
page.$setPageStyle({"backgroundColorContent" : this.isChange ? "" : "red"})
this.isChange = !this.isChange
}
}
}
</script>
<style>
.container {
flex: 1;
align-items: center;
justify-content: center;
}
</style>
......@@ -109,6 +109,10 @@
name: '设置导航条颜色',
url: 'set-navigation-bar-color',
},
{
name: '设置页面容器背景色',
url: 'set-page-backgroundColorContent',
},
{
name: '设置TabBar',
url: 'set-tabbar',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册