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

docs: findAll().at() migration notes #736

Merged
merged 1 commit into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
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
7 changes: 4 additions & 3 deletions docs/api/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -1056,12 +1056,13 @@ findAll(selector: string): DOMWrapper<Element>[]

```js
import { mount } from '@vue/test-utils'
import Component from './Component.vue'
import BaseTable from './BaseTable.vue'

test('findAll', () => {
const wrapper = mount(Component)
const wrapper = mount(BaseTable);

wrapper.findAll('[data-test="number"]') //=> found; returns array of DOMWrapper
// .findAll() returns an array of DOMWrappers
const thirdRow = wrapper.findAll('tr')[2];
})
```

Expand Down
16 changes: 16 additions & 0 deletions docs/migration/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -216,3 +216,19 @@ Vue 3 renamed the `vm.$destroy` to `vm.$unmount`. Vue Test Utils has followed su
### `scopedSlots` is now merged with `slots`

Vue 3 united the `slot` and `scoped-slot` syntax under a single syntax, `v-slot`, which you can read about in the [the docs](https://v3.vuejs.org/guide/migration/slots-unification.html#overview). Since `slot` and `scoped-slot` are now merged, the `scopedSlots` mounting option is now deprecated - just use the `slots` mounting option for everything.

### `findAll().at()` removed

`findAll()` now returns an array of DOMWrappers.

**Before:**

```js
wrapper.findAll('[data-test="token"]').at(0);
```

**After:**

```js
wrapper.findAll('[data-test="token"]')[0];
```