Created
January 26, 2018 12:45
-
-
Save lmiller1990/66913422ced3d8ac6b337f454c8b0b58 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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