Skip to content

Commit 932c0d3

Browse files
docs: add migration step for deprecated ref syntax in findAllComponents (#2498)
1 parent 12fe8af commit 932c0d3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed

docs/migration/index.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,28 @@ describe('App', () => {
276276
})
277277
```
278278
279+
### No more `ref` selector in `findAllComponents`
280+
281+
The `ref` syntax is not supported anymore in `findAllComponents`. You could set a `data-test` attribute instead and update the selector:
282+
283+
`Component.vue`:
284+
285+
```diff
286+
<template>
287+
- <FooComponent v-for="number in [1, 2, 3]" :key="number" ref="number">
288+
+ <FooComponent v-for="number in [1, 2, 3]" :key="number" data-test="number">
289+
{{ number }}
290+
</FooComponent>
291+
</template>
292+
```
293+
294+
`Component.spec.js`:
295+
296+
```diff
297+
- wrapper.findAllComponents({ ref: 'number' })
298+
+ wrapper.findAllComponents('[data-test="number"]')
299+
```
300+
279301
## Test runners upgrade notes
280302
281303
> Vue Test Utils is framework agnostic - you can use it with whichever test runner you like.

0 commit comments

Comments
 (0)