From 25c93e1be89ff3fad5327fcb14ec160b8bcbba3f Mon Sep 17 00:00:00 2001 From: Jiajun Chen Date: Thu, 23 May 2019 16:54:44 +0800 Subject: [PATCH] test(linear-progress): add snapshots (#264) --- .../__test__/LinearProgress.spec.js | 50 +++++++++++++++++++ .../__snapshots__/LinearProgress.spec.js.snap | 37 ++++++++++++++ 2 files changed, 87 insertions(+) create mode 100644 components/linear-progress/__test__/LinearProgress.spec.js create mode 100644 components/linear-progress/__test__/__snapshots__/LinearProgress.spec.js.snap diff --git a/components/linear-progress/__test__/LinearProgress.spec.js b/components/linear-progress/__test__/LinearProgress.spec.js new file mode 100644 index 000000000..6278dd606 --- /dev/null +++ b/components/linear-progress/__test__/LinearProgress.spec.js @@ -0,0 +1,50 @@ +import 'mutationobserver-shim' +import { mount } from '@vue/test-utils' +import LinearProgress from '../LinearProgress.vue' + +describe('LinearProgress', () => { + it('should mount', () => { + let wrapper = mount(LinearProgress) + expect(wrapper.isVueInstance()).toBeTruthy() + expect(wrapper.vm.$data.mdcLinearProgress).toBeDefined() + }) + + it('should render with no prop', () => { + let wrapper = mount(LinearProgress) + expect(wrapper).toMatchSnapshot() + expect(wrapper.classes()).toContain('mdc-linear-progress') + expect(wrapper.classes()).toContain('mdc-linear-progress--closed') + }) + + it('should render as open', () => { + let wrapper = mount(LinearProgress, { + propsData: { + open: true + } + }) + expect(wrapper).toMatchSnapshot() + expect(wrapper.isVisible()).toBe(true) + }) + + it('should render as reversed', () => { + let wrapper = mount(LinearProgress, { + propsData: { + open: true, + reverse: true + } + }) + expect(wrapper).toMatchSnapshot() + expect(wrapper.classes()).toContain('mdc-linear-progress--reversed') + }) + + it('should render as indeterminate', () => { + let wrapper = mount(LinearProgress, { + propsData: { + open: true, + indeterminate: true + } + }) + expect(wrapper).toMatchSnapshot() + expect(wrapper.classes()).toContain('mdc-linear-progress--indeterminate') + }) +}) diff --git a/components/linear-progress/__test__/__snapshots__/LinearProgress.spec.js.snap b/components/linear-progress/__test__/__snapshots__/LinearProgress.spec.js.snap new file mode 100644 index 000000000..eec792fd2 --- /dev/null +++ b/components/linear-progress/__test__/__snapshots__/LinearProgress.spec.js.snap @@ -0,0 +1,37 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`LinearProgress should render as indeterminate 1`] = ` +
+
+
+
+
+
+`; + +exports[`LinearProgress should render as open 1`] = ` +
+
+
+
+
+
+`; + +exports[`LinearProgress should render as reversed 1`] = ` +
+
+
+
+
+
+`; + +exports[`LinearProgress should render with no prop 1`] = ` +
+
+
+
+
+
+`;