diff --git a/example/app.json b/example/app.json index 9c15ec03..20f3ae9b 100644 --- a/example/app.json +++ b/example/app.json @@ -105,6 +105,7 @@ "van-popup": "./dist/popup/index", "van-popup-demo": "./dist/popup/demo/index", "van-progress": "./dist/progress/index", + "van-progress-demo": "./dist/progress/demo/index", "van-radio": "./dist/radio/index", "van-radio-demo": "./dist/radio/demo/index", "van-radio-group": "./dist/radio-group/index", diff --git a/example/pages/progress/index.wxml b/example/pages/progress/index.wxml index d8433a4f..ff0df46f 100644 --- a/example/pages/progress/index.wxml +++ b/example/pages/progress/index.wxml @@ -1,23 +1 @@ - - - - - - - - - - - - - - - - - + diff --git a/packages/progress/demo/index.json b/packages/progress/demo/index.json new file mode 100644 index 00000000..bc227778 --- /dev/null +++ b/packages/progress/demo/index.json @@ -0,0 +1,7 @@ +{ + "component": true, + "usingComponents": { + "van-progress": "../../progress/index", + "demo-block": "../../../example/components/demo-block/index" + } +} diff --git a/example/pages/progress/index.wxss b/packages/progress/demo/index.less similarity index 100% rename from example/pages/progress/index.wxss rename to packages/progress/demo/index.less diff --git a/packages/progress/demo/index.ts b/packages/progress/demo/index.ts new file mode 100644 index 00000000..a32755a5 --- /dev/null +++ b/packages/progress/demo/index.ts @@ -0,0 +1,5 @@ +import { VantComponent } from '../../common/component'; + +VantComponent({ + data: {}, +}); diff --git a/packages/progress/demo/index.wxml b/packages/progress/demo/index.wxml new file mode 100644 index 00000000..d8433a4f --- /dev/null +++ b/packages/progress/demo/index.wxml @@ -0,0 +1,23 @@ + + + + + + + + + + + + + + + + + diff --git a/packages/progress/test/__snapshots__/demo.spec.ts.snap b/packages/progress/test/__snapshots__/demo.spec.ts.snap new file mode 100644 index 00000000..5a425f7c --- /dev/null +++ b/packages/progress/test/__snapshots__/demo.spec.ts.snap @@ -0,0 +1,182 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`should render demo and match snapshot 1`] = ` +
+ + + + 基础用法 + + + + + + + 0% + + + + + + + + + + + 线条粗细 + + + + + + + 100% + + + + + + + + + + + 置灰 + + + + + + + 50% + + + + + + + + + + + 样式定制 + + + + + + + 橙色 + + + + + + + + + + + 红色 + + + + + + + + + + + 紫色 + + + + + + + +
+`; diff --git a/packages/progress/test/demo.spec.ts b/packages/progress/test/demo.spec.ts new file mode 100644 index 00000000..4c3798cb --- /dev/null +++ b/packages/progress/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(); +});