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

test(linear-progress): add snapshots #264

Merged
merged 2 commits into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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>
`;