This repository has been archived by the owner on Nov 30, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 44
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test(linear-progress): add snapshots (#264)
- Loading branch information
1 parent
4a2b41f
commit 25c93e1
Showing
2 changed files
with
87 additions
and
0 deletions.
There are no files selected for viewing
50 changes: 50 additions & 0 deletions
50
components/linear-progress/__test__/LinearProgress.spec.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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') | ||
}) | ||
}) |
37 changes: 37 additions & 0 deletions
37
components/linear-progress/__test__/__snapshots__/LinearProgress.spec.js.snap
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> | ||
`; |