Skip to content
This repository has been archived by the owner on Nov 30, 2020. It is now read-only.

Commit

Permalink
test(linear-progress): add snapshots (#264)
Browse files Browse the repository at this point in the history
  • Loading branch information
tychenjiajun authored May 23, 2019
1 parent 4a2b41f commit 25c93e1
Show file tree
Hide file tree
Showing 2 changed files with 87 additions and 0 deletions.
50 changes: 50 additions & 0 deletions components/linear-progress/__test__/LinearProgress.spec.js
Original file line number Diff line number Diff line change
@@ -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')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`LinearProgress should render as indeterminate 1`] = `
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--indeterminate">
<div class="mdc-linear-progress__buffering-dots"></div>
<div class="mdc-linear-progress__buffer" style="transform: scaleX(1);"></div>
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar" style="transform: scaleX(1);"><span class="mdc-linear-progress__bar-inner"></span></div>
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"><span class="mdc-linear-progress__bar-inner"></span></div>
</div>
`;

exports[`LinearProgress should render as open 1`] = `
<div role="progressbar" class="mdc-linear-progress">
<div class="mdc-linear-progress__buffering-dots"></div>
<div class="mdc-linear-progress__buffer" style="transform: scaleX(1);"></div>
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar" style="transform: scaleX(1);"><span class="mdc-linear-progress__bar-inner"></span></div>
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"><span class="mdc-linear-progress__bar-inner"></span></div>
</div>
`;

exports[`LinearProgress should render as reversed 1`] = `
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--reversed">
<div class="mdc-linear-progress__buffering-dots"></div>
<div class="mdc-linear-progress__buffer" style="transform: scaleX(1);"></div>
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar" style="transform: scaleX(1);"><span class="mdc-linear-progress__bar-inner"></span></div>
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"><span class="mdc-linear-progress__bar-inner"></span></div>
</div>
`;

exports[`LinearProgress should render with no prop 1`] = `
<div role="progressbar" class="mdc-linear-progress mdc-linear-progress--closed">
<div class="mdc-linear-progress__buffering-dots"></div>
<div class="mdc-linear-progress__buffer" style="transform: scaleX(1);"></div>
<div class="mdc-linear-progress__bar mdc-linear-progress__primary-bar" style="transform: scaleX(1);"><span class="mdc-linear-progress__bar-inner"></span></div>
<div class="mdc-linear-progress__bar mdc-linear-progress__secondary-bar"><span class="mdc-linear-progress__bar-inner"></span></div>
</div>
`;

0 comments on commit 25c93e1

Please sign in to comment.