diff --git a/example/app.json b/example/app.json index 72ebe923..36d66afa 100644 --- a/example/app.json +++ b/example/app.json @@ -83,6 +83,7 @@ "van-dialog": "./dist/dialog/index", "van-dialog-demo": "./dist/dialog/demo/index", "van-divider": "./dist/divider/index", + "van-divider-demo": "./dist/divider/demo/index", "van-empty": "./dist/empty/index", "van-field": "./dist/field/index", "van-goods-action": "./dist/goods-action/index", diff --git a/example/pages/divider/index.wxml b/example/pages/divider/index.wxml index b01a8fdb..39778490 100644 --- a/example/pages/divider/index.wxml +++ b/example/pages/divider/index.wxml @@ -1,17 +1 @@ - - - - - - 文本 - 文本 - 文本 - - - - - - - - 文本 - \ No newline at end of file + diff --git a/example/pages/divider/index.wxss b/example/pages/divider/index.wxss deleted file mode 100644 index c24354b1..00000000 --- a/example/pages/divider/index.wxss +++ /dev/null @@ -1,3 +0,0 @@ -page { - background-color: white; -} diff --git a/packages/divider/demo/index.json b/packages/divider/demo/index.json new file mode 100644 index 00000000..e006e591 --- /dev/null +++ b/packages/divider/demo/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-divider": "../../divider/index", + "demo-block": "../../../example/components/demo-block/index" + } +} diff --git a/packages/divider/demo/index.ts b/packages/divider/demo/index.ts new file mode 100644 index 00000000..a32755a5 --- /dev/null +++ b/packages/divider/demo/index.ts @@ -0,0 +1,5 @@ +import { VantComponent } from '../../common/component'; + +VantComponent({ + data: {}, +}); diff --git a/packages/divider/demo/index.wxml b/packages/divider/demo/index.wxml new file mode 100644 index 00000000..4c0c3c73 --- /dev/null +++ b/packages/divider/demo/index.wxml @@ -0,0 +1,17 @@ + + + + + + 文本 + 文本 + 文本 + + + + + + + + 文本 + diff --git a/packages/divider/test/__snapshots__/demo.spec.ts.snap b/packages/divider/test/__snapshots__/demo.spec.ts.snap new file mode 100644 index 00000000..9e97fdc7 --- /dev/null +++ b/packages/divider/test/__snapshots__/demo.spec.ts.snap @@ -0,0 +1,102 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render demo and match snapshot 1`] = ` +
+ + + + 基础用法 + + + + + + + + + + 内容位置 + + + + 文本 + + + + + 文本 + + + + + 文本 + + + + + + + + 虚线 + + + + + + + + + + 自定义样式 + + + + 文本 + + + + +
+`; diff --git a/packages/divider/test/demo.spec.ts b/packages/divider/test/demo.spec.ts new file mode 100644 index 00000000..4c3798cb --- /dev/null +++ b/packages/divider/test/demo.spec.ts @@ -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(); +});