Skip to content

Commit

Permalink
fix: fix typo & update naming
Browse files Browse the repository at this point in the history
  • Loading branch information
liuzhuan authored and cexbrayat committed Jun 21, 2022
1 parent 71947a7 commit a138ff3
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions docs/guide/essentials/forms.md
Expand Up @@ -364,9 +364,9 @@ Assume we have a form that uses the Vuetify textarea:

```vue
<template>
<form>
<form @submit.prevent="handleSubmit">
<v-textarea v-model="description" ref="description" />
<button @click="handleClick">Send</button>
<button type="submit">Send</button>
</form>
</template>
Expand All @@ -379,8 +379,8 @@ export default {
}
},
methods: {
handleClick() {
this.$emit('submit', this.description)
handleSubmit() {
this.$emit('submitted', this.description)
}
}
}
Expand All @@ -390,15 +390,15 @@ export default {
We can use `findComponent` to find the component instance, and then set its value.

```js
test('emits textarea value on click', async () => {
test('emits textarea value on submit', async () => {
const wrapper = mount(CustomTextarea)
const description = 'Some very long text...'

await wrapper.findComponent({ ref: 'description' }).setValue(description)

wrapper.find('.submit').trigger('click')
wrapper.find('form').trigger('submit')

expect(wrapper.emitted('submit')[0][0]).toEqual({ description })
expect(wrapper.emitted('submitted')[0][0]).toEqual(description)
})
```

Expand Down

0 comments on commit a138ff3

Please sign in to comment.