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

Commit 4a2b41f

Browse files
author
Jiajun Chen
authored
test(floating-label): add snapshots (#263)
1 parent c335269 commit 4a2b41f

File tree

2 files changed

+44
-0
lines changed

2 files changed

+44
-0
lines changed
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
import 'mutationobserver-shim'
2+
import { mount } from '@vue/test-utils'
3+
import FloatingLabel from '../FloatingLabel.vue'
4+
5+
describe('FloatingLabel', () => {
6+
it('should mount', () => {
7+
let wrapper = mount(FloatingLabel)
8+
expect(wrapper.isVueInstance()).toBeTruthy()
9+
expect(wrapper.vm.$data.mdcFloatingLabel).toBeDefined()
10+
})
11+
12+
it('should render with no prop', () => {
13+
let wrapper = mount(FloatingLabel)
14+
expect(wrapper).toMatchSnapshot()
15+
expect(wrapper.classes()).toContain('mdc-floating-label')
16+
})
17+
18+
it('should render with floatAbove', () => {
19+
let wrapper = mount(FloatingLabel, {
20+
propsData: {
21+
floatAbove: true
22+
}
23+
})
24+
expect(wrapper).toMatchSnapshot()
25+
expect(wrapper.classes()).toContain('mdc-floating-label--float-above')
26+
})
27+
28+
it('should render with shake', () => {
29+
let wrapper = mount(FloatingLabel, {
30+
propsData: {
31+
shake: true
32+
}
33+
})
34+
expect(wrapper).toMatchSnapshot()
35+
expect(wrapper.classes()).toContain('mdc-floating-label--shake')
36+
})
37+
})
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`FloatingLabel should render with floatAbove 1`] = `<label class="mdc-floating-label mdc-floating-label--float-above"></label>`;
4+
5+
exports[`FloatingLabel should render with no prop 1`] = `<label class="mdc-floating-label"></label>`;
6+
7+
exports[`FloatingLabel should render with shake 1`] = `<label class="mdc-floating-label mdc-floating-label--shake"></label>`;

0 commit comments

Comments
 (0)