Skip to content
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

Merged
merged 1 commit into from Jun 21, 2022
Merged

fix: fix typo #1608

merged 1 commit into from Jun 21, 2022

Conversation

liuzhuan
Copy link
Contributor

No description provided.

@netlify
Copy link

netlify bot commented Jun 17, 2022

Deploy Preview for vue-test-utils-docs ready!

Name Link
🔨 Latest commit 34edcd7
🔍 Latest deploy log https://app.netlify.com/sites/vue-test-utils-docs/deploys/62b14ba1552dbf000814a68e
😎 Deploy Preview https://deploy-preview-1608--vue-test-utils-docs.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site settings.

@@ -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>
Copy link
Member

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?

Copy link
Contributor Author

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.

Copy link
Contributor Author

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().

@cexbrayat
Copy link
Member

Thanks @liuzhuan 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants