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

Commit

Permalink
test(floating-label): add snapshots (#263)
Browse files Browse the repository at this point in the history
  • Loading branch information
tychenjiajun authored May 23, 2019
1 parent c335269 commit 4a2b41f
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
37 changes: 37 additions & 0 deletions components/floating-label/__test__/FloatingLabel.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
import 'mutationobserver-shim'
import { mount } from '@vue/test-utils'
import FloatingLabel from '../FloatingLabel.vue'

describe('FloatingLabel', () => {
it('should mount', () => {
let wrapper = mount(FloatingLabel)
expect(wrapper.isVueInstance()).toBeTruthy()
expect(wrapper.vm.$data.mdcFloatingLabel).toBeDefined()
})

it('should render with no prop', () => {
let wrapper = mount(FloatingLabel)
expect(wrapper).toMatchSnapshot()
expect(wrapper.classes()).toContain('mdc-floating-label')
})

it('should render with floatAbove', () => {
let wrapper = mount(FloatingLabel, {
propsData: {
floatAbove: true
}
})
expect(wrapper).toMatchSnapshot()
expect(wrapper.classes()).toContain('mdc-floating-label--float-above')
})

it('should render with shake', () => {
let wrapper = mount(FloatingLabel, {
propsData: {
shake: true
}
})
expect(wrapper).toMatchSnapshot()
expect(wrapper.classes()).toContain('mdc-floating-label--shake')
})
})
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`FloatingLabel should render with floatAbove 1`] = `<label class="mdc-floating-label mdc-floating-label--float-above"></label>`;

exports[`FloatingLabel should render with no prop 1`] = `<label class="mdc-floating-label"></label>`;

exports[`FloatingLabel should render with shake 1`] = `<label class="mdc-floating-label mdc-floating-label--shake"></label>`;

0 comments on commit 4a2b41f

Please sign in to comment.