Skip to content

Instantly share code, notes, and snippets.

@lmiller1990
Created January 26, 2018 12:45
Show Gist options
  • Save lmiller1990/66913422ced3d8ac6b337f454c8b0b58 to your computer and use it in GitHub Desktop.
Save lmiller1990/66913422ced3d8ac6b337f454c8b0b58 to your computer and use it in GitHub Desktop.
import { shallow } from 'vue-test-utils'
import CreatePostLayout from './CreatePostLayout'
describe('CreatePostLayout', () => {
const stub = tag => `<div id=${tag} />`
it('emits a submit event when submitted', () => {
const wrapper = shallow(CreatePostLayout)
wrapper.find('form').trigger('submit.prevent')
expect(wrapper.emitted().submit).toHaveLength(1)
})
it('renders description and submit slots', () => {
const wrapper = shallow(CreatePostLayout, {
slots: {
description: stub('description'),
submit: stub('submit')
}
})
expect(wrapper.find('#description').exists()).toBe(true)
expect(wrapper.find('#submit').exists()).toBe(true)
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment