mirror of
https://gitee.com/vant-contrib/vant-weapp.git
synced 2025-04-06 03:58:05 +08:00
test(Divider): add demo test
This commit is contained in:
parent
03ee861ca6
commit
75eec05604
@ -83,6 +83,7 @@
|
|||||||
"van-dialog": "./dist/dialog/index",
|
"van-dialog": "./dist/dialog/index",
|
||||||
"van-dialog-demo": "./dist/dialog/demo/index",
|
"van-dialog-demo": "./dist/dialog/demo/index",
|
||||||
"van-divider": "./dist/divider/index",
|
"van-divider": "./dist/divider/index",
|
||||||
|
"van-divider-demo": "./dist/divider/demo/index",
|
||||||
"van-empty": "./dist/empty/index",
|
"van-empty": "./dist/empty/index",
|
||||||
"van-field": "./dist/field/index",
|
"van-field": "./dist/field/index",
|
||||||
"van-goods-action": "./dist/goods-action/index",
|
"van-goods-action": "./dist/goods-action/index",
|
||||||
|
@ -1,17 +1 @@
|
|||||||
<demo-block custom-class="white" title="基础用法" padding>
|
<van-divider-demo />
|
||||||
<van-divider />
|
|
||||||
</demo-block>
|
|
||||||
|
|
||||||
<demo-block custom-class="white" title="内容位置" padding>
|
|
||||||
<van-divider content-position="center">文本</van-divider>
|
|
||||||
<van-divider content-position="left">文本</van-divider>
|
|
||||||
<van-divider content-position="right">文本</van-divider>
|
|
||||||
</demo-block>
|
|
||||||
|
|
||||||
<demo-block custom-class="white" title="虚线" padding>
|
|
||||||
<van-divider dashed />
|
|
||||||
</demo-block>
|
|
||||||
|
|
||||||
<demo-block custom-class="white" title="自定义样式" padding>
|
|
||||||
<van-divider content-position="center" custom-style="color: #1989fa;border-color: #1989fa;font-size: 18px;">文本</van-divider>
|
|
||||||
</demo-block>
|
|
||||||
|
@ -1,3 +0,0 @@
|
|||||||
page {
|
|
||||||
background-color: white;
|
|
||||||
}
|
|
7
packages/divider/demo/index.json
Normal file
7
packages/divider/demo/index.json
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
{
|
||||||
|
"component": true,
|
||||||
|
"usingComponents": {
|
||||||
|
"van-divider": "../../divider/index",
|
||||||
|
"demo-block": "../../../example/components/demo-block/index"
|
||||||
|
}
|
||||||
|
}
|
5
packages/divider/demo/index.ts
Normal file
5
packages/divider/demo/index.ts
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
import { VantComponent } from '../../common/component';
|
||||||
|
|
||||||
|
VantComponent({
|
||||||
|
data: {},
|
||||||
|
});
|
17
packages/divider/demo/index.wxml
Normal file
17
packages/divider/demo/index.wxml
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
<demo-block custom-class="white" title="基础用法" padding>
|
||||||
|
<van-divider />
|
||||||
|
</demo-block>
|
||||||
|
|
||||||
|
<demo-block custom-class="white" title="内容位置" padding>
|
||||||
|
<van-divider content-position="center">文本</van-divider>
|
||||||
|
<van-divider content-position="left">文本</van-divider>
|
||||||
|
<van-divider content-position="right">文本</van-divider>
|
||||||
|
</demo-block>
|
||||||
|
|
||||||
|
<demo-block custom-class="white" title="虚线" padding>
|
||||||
|
<van-divider dashed />
|
||||||
|
</demo-block>
|
||||||
|
|
||||||
|
<demo-block custom-class="white" title="自定义样式" padding>
|
||||||
|
<van-divider content-position="center" custom-style="color: #1989fa;border-color: #1989fa;font-size: 18px;">文本</van-divider>
|
||||||
|
</demo-block>
|
102
packages/divider/test/__snapshots__/demo.spec.ts.snap
Normal file
102
packages/divider/test/__snapshots__/demo.spec.ts.snap
Normal file
@ -0,0 +1,102 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`should render demo and match snapshot 1`] = `
|
||||||
|
<main>
|
||||||
|
<demo-block
|
||||||
|
customClass="white"
|
||||||
|
>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class demo-block van-clearfix demo-block--padding"
|
||||||
|
>
|
||||||
|
<wx-view
|
||||||
|
class="demo-block__title"
|
||||||
|
>
|
||||||
|
基础用法
|
||||||
|
</wx-view>
|
||||||
|
<van-divider>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class van-divider"
|
||||||
|
style=""
|
||||||
|
/>
|
||||||
|
</van-divider>
|
||||||
|
</wx-view>
|
||||||
|
</demo-block>
|
||||||
|
<demo-block
|
||||||
|
customClass="white"
|
||||||
|
>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class demo-block van-clearfix demo-block--padding"
|
||||||
|
>
|
||||||
|
<wx-view
|
||||||
|
class="demo-block__title"
|
||||||
|
>
|
||||||
|
内容位置
|
||||||
|
</wx-view>
|
||||||
|
<van-divider>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class van-divider van-divider--center"
|
||||||
|
style=""
|
||||||
|
>
|
||||||
|
文本
|
||||||
|
</wx-view>
|
||||||
|
</van-divider>
|
||||||
|
<van-divider>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class van-divider van-divider--left"
|
||||||
|
style=""
|
||||||
|
>
|
||||||
|
文本
|
||||||
|
</wx-view>
|
||||||
|
</van-divider>
|
||||||
|
<van-divider>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class van-divider van-divider--right"
|
||||||
|
style=""
|
||||||
|
>
|
||||||
|
文本
|
||||||
|
</wx-view>
|
||||||
|
</van-divider>
|
||||||
|
</wx-view>
|
||||||
|
</demo-block>
|
||||||
|
<demo-block
|
||||||
|
customClass="white"
|
||||||
|
>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class demo-block van-clearfix demo-block--padding"
|
||||||
|
>
|
||||||
|
<wx-view
|
||||||
|
class="demo-block__title"
|
||||||
|
>
|
||||||
|
虚线
|
||||||
|
</wx-view>
|
||||||
|
<van-divider>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class van-divider van-divider--dashed"
|
||||||
|
style=""
|
||||||
|
/>
|
||||||
|
</van-divider>
|
||||||
|
</wx-view>
|
||||||
|
</demo-block>
|
||||||
|
<demo-block
|
||||||
|
customClass="white"
|
||||||
|
>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class demo-block van-clearfix demo-block--padding"
|
||||||
|
>
|
||||||
|
<wx-view
|
||||||
|
class="demo-block__title"
|
||||||
|
>
|
||||||
|
自定义样式
|
||||||
|
</wx-view>
|
||||||
|
<van-divider>
|
||||||
|
<wx-view
|
||||||
|
class="custom-class van-divider van-divider--center"
|
||||||
|
style=";color: #1989fa;border-color: #1989fa;font-size: 18px;"
|
||||||
|
>
|
||||||
|
文本
|
||||||
|
</wx-view>
|
||||||
|
</van-divider>
|
||||||
|
</wx-view>
|
||||||
|
</demo-block>
|
||||||
|
</main>
|
||||||
|
`;
|
11
packages/divider/test/demo.spec.ts
Normal file
11
packages/divider/test/demo.spec.ts
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
import path from 'path';
|
||||||
|
import simulate from 'miniprogram-simulate';
|
||||||
|
|
||||||
|
test('should render demo and match snapshot', () => {
|
||||||
|
const id = simulate.load(path.resolve(__dirname, '../demo/index'), {
|
||||||
|
rootPath: path.resolve(__dirname, '../../'),
|
||||||
|
});
|
||||||
|
const comp = simulate.render(id);
|
||||||
|
comp.attach(document.createElement('parent-wrapper'));
|
||||||
|
expect(comp.toJSON()).toMatchSnapshot();
|
||||||
|
});
|
Loading…
x
Reference in New Issue
Block a user