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

chore: add migration step for deprecated ref syntax in findAllComponents #2498

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions docs/migration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,28 @@ describe('App', () => {
})
```

### No more `ref` selector in `findAllComponents`

The `ref` syntax is not supported anymore in `findAllComponents`. You could set a `data-test` attribute instead and update the selector:

`Component.vue`:

```diff
<template>
- <FooComponent v-for="number in [1, 2, 3]" :key="number" ref="number">
+ <FooComponent v-for="number in [1, 2, 3]" :key="number" data-test="number">
{{ number }}
</FooComponent>
</template>
```

`Component.spec.js`:

```diff
- wrapper.findAllComponents({ ref: 'number' })
+ wrapper.findAllComponents('[data-test="number"]')
```

## Test runners upgrade notes

> Vue Test Utils is framework agnostic - you can use it with whichever test runner you like.
Expand Down