New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: fix typo #1608
fix: fix typo #1608
Conversation
✅ Deploy Preview for vue-test-utils-docs ready!
To edit notification comments on pull requests, go to your Netlify site settings. |
docs/guide/essentials/forms.md
Outdated
@@ -366,7 +366,7 @@ Assume we have a form that uses the Vuetify textarea: | |||
<template> | |||
<form> | |||
<v-textarea v-model="description" ref="description" /> | |||
<button @click="handleClick">Send</button> | |||
<button class="submit" @click="handleClick">Send</button> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good catch, but it would be better to use type="submit"
, and change the test to wrapper.find('button[type=submit]')
Anyway, as I was reading this example again, I think it is not a very good one. It should handle the submit event on the form instead of the click on the button, and the emitted event should have a different name than submit
.
Could you update your PR with:
<template>
<form @submit.prevent="handleSubmit">
<v-textarea v-model="description" ref="description" />
<button type="submit">Send</button>
</form>
</template>
<script>
export default {
name: 'CustomTextarea',
data() {
return {
description: ''
}
},
methods: {
handleSubmit() {
this.$emit('submitted', this.description)
}
}
}
</script>
and update the test below to use the submitted
event instead of the submit
one?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good idea, I'm on it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@cexbrayat The click
event of <button>
is changed into submit
event of <form>
. If not, a new container has to be created and attachTo-ed, according to Native form submission, which might cause distractions to findComponent()
.
Thanks @liuzhuan 👍 |
No description provided.