diff --git a/src/grid/test/__snapshots__/index.legacy.js.snap b/src/grid/test/__snapshots__/index.legacy.js.snap
deleted file mode 100644
index 1387be1b9..000000000
--- a/src/grid/test/__snapshots__/index.legacy.js.snap
+++ /dev/null
@@ -1,37 +0,0 @@
-// Jest Snapshot v1, https://goo.gl/fbAQLP
-
-exports[`icon-size prop 1`] = `
-
-`;
-
-exports[`render icon-slot 1`] = `
-
-`;
-
-exports[`sqaure and set gutter 1`] = `
-
-`;
diff --git a/src/grid/test/__snapshots__/index.spec.js.snap b/src/grid/test/__snapshots__/index.spec.js.snap
new file mode 100644
index 000000000..e24978336
--- /dev/null
+++ b/src/grid/test/__snapshots__/index.spec.js.snap
@@ -0,0 +1,49 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`should render icon-slot correctly 1`] = `
+
+`;
+
+exports[`should render square grid with gutter correctly 1`] = `
+
+`;
diff --git a/src/grid/test/index.legacy.js b/src/grid/test/index.legacy.js
deleted file mode 100644
index 79eb1b7d2..000000000
--- a/src/grid/test/index.legacy.js
+++ /dev/null
@@ -1,62 +0,0 @@
-import { mount } from '@vue/test-utils';
-
-test('click grid item', () => {
- const onClick = jest.fn();
- const wrapper = mount({
- template: `
-
-
-
- `,
- methods: {
- onClick,
- },
- });
-
- const Item = wrapper.find('.van-grid-item__content');
- Item.trigger('click');
-
- expect(onClick).toHaveBeenCalledTimes(1);
-});
-
-test('sqaure and set gutter', () => {
- const wrapper = mount({
- template: `
-
-
-
-
-
- `,
- });
-
- expect(wrapper.html()).toMatchSnapshot();
-});
-
-test('icon-size prop', () => {
- const wrapper = mount({
- template: `
-
-
-
- `,
- });
-
- expect(wrapper.html()).toMatchSnapshot();
-});
-
-test('render icon-slot', () => {
- const wrapper = mount({
- template: `
-
-
-
- Custom Icon
-
-
-
- `,
- });
-
- expect(wrapper.html()).toMatchSnapshot();
-});
diff --git a/src/grid/test/index.spec.js b/src/grid/test/index.spec.js
new file mode 100644
index 000000000..7506c3b78
--- /dev/null
+++ b/src/grid/test/index.spec.js
@@ -0,0 +1,49 @@
+import { mount } from '@vue/test-utils';
+import Grid from '..';
+import GridItem from '../../grid-item';
+
+test('should render square grid with gutter correctly', () => {
+ const wrapper = mount({
+ render() {
+ return (
+
+
+
+
+
+ );
+ },
+ });
+
+ expect(wrapper.html()).toMatchSnapshot();
+});
+
+test('should change icon size when using icon-size prop', () => {
+ const wrapper = mount({
+ render() {
+ return (
+
+
+
+ );
+ },
+ });
+
+ expect(wrapper.find('.van-grid-item__icon').element.style.fontSize).toEqual(
+ '10px'
+ );
+});
+
+test('should render icon-slot correctly', () => {
+ const wrapper = mount({
+ render() {
+ return (
+
+ 'Custom Icon' }} />
+
+ );
+ },
+ });
+
+ expect(wrapper.html()).toMatchSnapshot();
+});
diff --git a/test/demo.ts b/test/demo.ts
index d65960621..98f545f9f 100644
--- a/test/demo.ts
+++ b/test/demo.ts
@@ -8,7 +8,7 @@ Locale.use('en-US', enUS);
const EmptyComponent = {
render() {
- return h('div', [(this as any).$slots.default()]);
+ return h('div', [this.$slots.default()]);
},
inheritAttrs: false,
};
@@ -28,7 +28,6 @@ export function snapshotDemo(Demo: any, option: any = {}) {
mixins: [DemoLocaleMixin],
components: {
'demo-block': EmptyComponent,
- 'demo-section': EmptyComponent,
},
plugins: [(window as any).vant],
},