diff --git a/packages/card/test/index.spec.js b/packages/card/test/index.spec.js
index 85a93fad8..f4af8a3c0 100644
--- a/packages/card/test/index.spec.js
+++ b/packages/card/test/index.spec.js
@@ -1,67 +1,57 @@
-import Vue from 'vue';
import Card from '..';
import { mount } from '../../../test/utils';
-Vue.use(Card);
-
-test('render origin-price slot', () => {
- const wrapper = mount({
- template: `
-
- Custom Origin Price
-
- `
+test('render price & num slot', () => {
+ const wrapper = mount(Card, {
+ scopedSlots: {
+ num: () => 'Custom Num',
+ price: () => 'Custom Price'
+ }
});
expect(wrapper).toMatchSnapshot();
});
-test('render price & num slot', () => {
- const wrapper = mount({
- template: `
-
- Custom Num
- Custom Price
-
- `
+test('render origin-price slot', () => {
+ const wrapper = mount(Card, {
+ scopedSlots: {
+ 'origin-price': () => 'Custom Origin Price'
+ }
});
expect(wrapper).toMatchSnapshot();
});
test('render bottom slot', () => {
- const wrapper = mount({
- template: `
-
- Custom Bottom
-
- `
+ const wrapper = mount(Card, {
+ propsData: {
+ price: 100
+ },
+ scopedSlots: {
+ bottom: () => 'Custom Bottom'
+ }
});
expect(wrapper).toMatchSnapshot();
});
test('render thumb & tag slot', () => {
- const wrapper = mount({
- template: `
-
- Custom Thumb
- Custom Tag
-
- `
+ const wrapper = mount(Card, {
+ scopedSlots: {
+ tag: () => 'Custom Tag',
+ thumb: () => 'Custom Thumb'
+ }
});
expect(wrapper).toMatchSnapshot();
});
test('render title & desc slot', () => {
- const wrapper = mount({
- template: `
-
- Custom Title
- Custom desc
-
- `
+ const wrapper = mount(Card, {
+ scopedSlots: {
+ title: () => 'Custom Title',
+ desc: () => 'Custom desc'
+ }
});
expect(wrapper).toMatchSnapshot();
diff --git a/packages/nav-bar/test/__snapshots__/index.spec.js.snap b/packages/nav-bar/test/__snapshots__/index.spec.js.snap
new file mode 100644
index 000000000..092b64cdc
--- /dev/null
+++ b/packages/nav-bar/test/__snapshots__/index.spec.js.snap
@@ -0,0 +1,17 @@
+// Jest Snapshot v1, https://goo.gl/fbAQLP
+
+exports[`render left & right slot 1`] = `
+
+
Custom Left
+
+
Custom Right
+
+`;
+
+exports[`render title slot 1`] = `
+
+`;
diff --git a/packages/nav-bar/test/index.spec.js b/packages/nav-bar/test/index.spec.js
new file mode 100644
index 000000000..12ce9cbe2
--- /dev/null
+++ b/packages/nav-bar/test/index.spec.js
@@ -0,0 +1,23 @@
+import NavBar from '..';
+import { mount } from '../../../test/utils';
+
+test('render left & right slot', () => {
+ const wrapper = mount(NavBar, {
+ scopedSlots: {
+ left: () => 'Custom Left',
+ right: () => 'Custom Right'
+ }
+ });
+
+ expect(wrapper).toMatchSnapshot();
+});
+
+test('render title slot', () => {
+ const wrapper = mount(NavBar, {
+ scopedSlots: {
+ title: () => 'Custom Title'
+ }
+ });
+
+ expect(wrapper).toMatchSnapshot();
+});