diff --git a/components/floating-label/__test__/FloatingLabel.spec.js b/components/floating-label/__test__/FloatingLabel.spec.js new file mode 100644 index 000000000..af2b8ce16 --- /dev/null +++ b/components/floating-label/__test__/FloatingLabel.spec.js @@ -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') + }) +}) diff --git a/components/floating-label/__test__/__snapshots__/FloatingLabel.spec.js.snap b/components/floating-label/__test__/__snapshots__/FloatingLabel.spec.js.snap new file mode 100644 index 000000000..8ae843fa7 --- /dev/null +++ b/components/floating-label/__test__/__snapshots__/FloatingLabel.spec.js.snap @@ -0,0 +1,7 @@ +// Jest Snapshot v1, https://goo.gl/fbAQLP + +exports[`FloatingLabel should render with floatAbove 1`] = ``; + +exports[`FloatingLabel should render with no prop 1`] = ``; + +exports[`FloatingLabel should render with shake 1`] = ``;