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

test(floating-label): add snapshots #263

Merged
merged 2 commits into from
May 23, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
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
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>`;