提交 479473ee 编写于 作者: study夏羽's avatar study夏羽

add rendering

上级 5d624eac
......@@ -6,6 +6,6 @@ module.exports = {
watchPathIgnorePatterns: ['/node_modules/', '/dist/', '/.git/'],
moduleFileExtensions: ['js', 'json'],
rootDir: __dirname,
testMatch: ["<rootDir>/pages/state/**/*.test.js"],
testMatch: ["<rootDir>/pages/**/**/*.test.js"],
testPathIgnorePatterns: ['/node_modules/']
}
......@@ -174,7 +174,21 @@
"navigationBarTitleText": "",
"enablePullDownRefresh": false
}
}
},
{
"path": "pages/rendering/slots/slots",
"style": {
"navigationBarTitleText": "slots",
"enablePullDownRefresh": false
}
},
{
"path": "pages/rendering/template/template",
"style": {
"navigationBarTitleText": "template",
"enablePullDownRefresh": false
}
}
],
"globalStyle": {
"pageOrientation": "portrait",
......
......@@ -89,7 +89,10 @@
id: 'rendering',
name: '渲染选项',
open: false,
pages: ['template', 'render', 'slots'].map(createPageItem('rendering'))
pages: [
'template',
// 'render',
'slots'].map(createPageItem('rendering'))
},
{
id: 'component-instance',
......
<template>
<view class="container">
<view>
<slot name="header"></slot>
</view>
<view>
<slot></slot>
</view>
<view>
<slot name="footer"></slot>
</view>
</view>
</template>
<script>
export default {
name:"child",
data() {
return {}
},
methods: {}
}
</script>
<style>
</style>
\ No newline at end of file
// uni-app自动化测试教程: uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('/pages/rendering/slots/slots', () => {
let page;
beforeAll(async () => {
page = await program.reLaunch('/pages/rendering/slots/slots')
await page.waitFor(500)
});
it('slots', async () => {
expect.assertions(3);
const childEl = await page.$('child');
const headerEl = await childEl.$('.header');
expect(await headerEl.text()).toEqual("Here might be a page title");
const mainEl = await childEl.$('.main');
expect(await mainEl.text()).toEqual("A paragraph for the main content.");
const footerEl = await childEl.$('.footer');
expect(await footerEl.text()).toEqual("Here's some contact info");
});
});
\ No newline at end of file
<template>
<view class="content">
<child>
<template v-slot:header>
<view class="header">Here might be a page title</view>
</template>
<template v-slot:default>
<view class="main">A paragraph for the main content.</view>
</template>
<template v-slot:footer>
<view class="footer">Here's some contact info</view>
</template>
</child>
</view>
</template>
<script>
import child from './child.uvue';
export default {
components:{child},
data() {
return {}
},
onLoad() {
},
methods: {
}
}
</script>
<style>
</style>
\ No newline at end of file
// uni-app自动化测试教程: https://uniapp.dcloud.net.cn/worktile/auto/hbuilderx-extension/
describe('/pages/rendering/template/template', () => {
let page
beforeAll(async () => {
page = await program.reLaunch('/pages/rendering/template/template')
await page.waitFor(500)
})
it('template', async () => {
expect.assertions(2);
const showBtn = await page.$('.show-botton')
await showBtn.tap()
expect((await page.data()).isShow).toBeFalsy()
expect((await page.$$('.item')).length).toBe(2)
})
});
\ No newline at end of file
<template>
<view class="container">
<template v-if="isShow">
<view>{{title}}</view>
</template>
<view class="show-botton" @click="handleShow">{{isShow?'点击隐藏':'点击显示'}}</view>
<template v-for="(item,index) in list" :key="index">
<view class="item">{{index+1}}.{{item.name}}</view>
</template>
</view>
</template>
<script>
type objType = {
name: string
}
export default {
data() {
return {
title: "hello",
isShow: true,
list: [{
name: 'foo1'
},
{
name: 'foo2'
}
] as objType[]
}
},
methods: {
handleShow() {
this.isShow = !this.isShow
}
}
}
</script>
<style>
.item {
display: flex;
flex-direction: row;
margin: 15px;
border: #eee solid 1px;
}
</style>
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册