Skip to content

Instantly share code, notes, and snippets.

@lmiller1990
Last active January 26, 2018 12:23
Show Gist options
  • Save lmiller1990/42ed9379d72e08bea7e3eddc924a70bf to your computer and use it in GitHub Desktop.
Save lmiller1990/42ed9379d72e08bea7e3eddc924a70bf to your computer and use it in GitHub Desktop.
import { shallow } from 'vue-test-utils'
import SubmitButton from './SubmitButton'
describe('SubmitButton', () => {
const factory = (values = {}) => {
return shallow(SubmitButton, {
propsData: values
})
}
it('renders the default state and receives props', () => {
const wrapper = factory({ submitted: false })
expect(wrapper.classes('button')).toEqual(['button'])
expect(wrapper.find('button').vnode.data.attrs.disabled).toBe(false)
})
it('has a button--submitted class when submitted is true', () => {
const wrapper = factory({ submitted: true })
expect(wrapper.classes('button')).toEqual(['button--submitted'])
expect(wrapper.find('button').vnode.data.attrs.disabled).toBe(true)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment