Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <template>
- <form @submit.prevent="$emit('submitEventTriggered')">
- <button type="submit">Submit Form</button>
- </form>
- </template>
- <script>
- export default {}
- </script>
- import {shallowMount} from '@vue/test-utils'
- import {assert} from 'chai'
- import Form from '@/components/Form.vue'
- describe.only('Form', () => {
- it('button click triggers submit event', () => {
- const wrapper = shallowMount(Form)
- wrapper.find('[type='submit']').trigger('click')
- assert.exists(wrapper.emitted('submitEventTriggered'), 'Form submit not triggered')
- })
- })
- AssertionError: Form submit event triggered: expected undefined to exist
Add Comment
Please, Sign In to add comment