diff --git a/example/app.json b/example/app.json
index 60d28a40..84630033 100644
--- a/example/app.json
+++ b/example/app.json
@@ -137,7 +137,8 @@
"van-skeleton": "./dist/skeleton/index",
"van-calendar": "./dist/calendar/index",
"van-share-sheet": "./dist/share-sheet/index",
- "van-config-provider": "./dist/config-provider/index"
+ "van-config-provider": "./dist/config-provider/index",
+ "van-config-provider-demo": "./dist/config-provider/demo/index"
},
"sitemapLocation": "sitemap.json"
}
diff --git a/example/pages/config-provider/index.js b/example/pages/config-provider/index.js
index 8881f493..cc11dfda 100644
--- a/example/pages/config-provider/index.js
+++ b/example/pages/config-provider/index.js
@@ -1,24 +1,3 @@
import Page from '../../common/page';
-Page({
- data: {
- rate: 4,
- slider: 50,
- themeVars: {
- rateIconFullColor: '#07c160',
- sliderBarHeight: '4px',
- sliderButtonWidth: '20px',
- sliderButtonHeight: '20px',
- sliderActiveBackgroundColor: '#07c160',
- buttonPrimaryBorderColor: '#07c160',
- buttonPrimaryBackgroundColor: '#07c160',
- },
- },
-
- onChange(event) {
- const { key } = event.currentTarget.dataset;
- this.setData({
- [key]: event.detail,
- });
- },
-});
+Page();
diff --git a/example/pages/config-provider/index.wxml b/example/pages/config-provider/index.wxml
index df95c7a3..260a1ac7 100644
--- a/example/pages/config-provider/index.wxml
+++ b/example/pages/config-provider/index.wxml
@@ -1,39 +1 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 提交
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- 提交
-
-
-
+
diff --git a/packages/config-provider/demo/index.json b/packages/config-provider/demo/index.json
new file mode 100644
index 00000000..c2631c2d
--- /dev/null
+++ b/packages/config-provider/demo/index.json
@@ -0,0 +1,12 @@
+{
+ "component": true,
+ "usingComponents": {
+ "van-rate": "../../rate/index",
+ "van-field": "../../field/index",
+ "van-slider": "../../slider/index",
+ "van-button": "../../button/index",
+ "van-cell-group": "../../cell-group/index",
+ "van-config-provider": "../../config-provider/index",
+ "demo-block": "../../../example/components/demo-block/index"
+ }
+}
diff --git a/packages/config-provider/demo/index.ts b/packages/config-provider/demo/index.ts
new file mode 100644
index 00000000..bdc956fd
--- /dev/null
+++ b/packages/config-provider/demo/index.ts
@@ -0,0 +1,26 @@
+import { VantComponent } from '../../common/component';
+
+VantComponent({
+ data: {
+ rate: 4,
+ slider: 50,
+ themeVars: {
+ rateIconFullColor: '#07c160',
+ sliderBarHeight: '4px',
+ sliderButtonWidth: '20px',
+ sliderButtonHeight: '20px',
+ sliderActiveBackgroundColor: '#07c160',
+ buttonPrimaryBorderColor: '#07c160',
+ buttonPrimaryBackgroundColor: '#07c160',
+ },
+ },
+
+ methods: {
+ onChange(event) {
+ const { key } = event.currentTarget.dataset;
+ this.setData({
+ [key]: event.detail,
+ });
+ },
+ },
+});
diff --git a/packages/config-provider/demo/index.wxml b/packages/config-provider/demo/index.wxml
new file mode 100644
index 00000000..df95c7a3
--- /dev/null
+++ b/packages/config-provider/demo/index.wxml
@@ -0,0 +1,39 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 提交
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 提交
+
+
+
diff --git a/packages/config-provider/test/__snapshots__/demo.spec.ts.snap b/packages/config-provider/test/__snapshots__/demo.spec.ts.snap
new file mode 100644
index 00000000..a412b0f9
--- /dev/null
+++ b/packages/config-provider/test/__snapshots__/demo.spec.ts.snap
@@ -0,0 +1,711 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render demo and match snapshot 1`] = `
+
+
+
+
+ 默认主题
+
+
+
+
+
+
+
+
+
+ 评分
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 滑块
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 提交
+
+
+
+
+
+
+
+
+
+ 定制主题
+
+
+
+
+
+
+
+
+
+
+
+ 评分
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 滑块
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 提交
+
+
+
+
+
+
+
+
+
+`;
diff --git a/packages/config-provider/test/demo.spec.ts b/packages/config-provider/test/demo.spec.ts
new file mode 100644
index 00000000..4c3798cb
--- /dev/null
+++ b/packages/config-provider/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();
+});