You’re browsing the documentation for Vue Test Utils for Vue v2.x and earlier.

To read docs for Vue Test Utils for Vue 3, click here.

at(index)

Возвращает Wrapper по указанному индексу index. Используется нумерация с нуля (т.е. первый элемент имеет индекс 0).

  • Принимает:

    • {number} index
  • Возвращает: {Wrapper}

  • Пример:

import { shallowMount } from '@vue/test-utils'
import Foo from './Foo.vue'

const wrapper = shallowMount(Foo)
const divArray = wrapper.findAll('div')
const secondDiv = divArray.at(1)
expect(secondDiv.is('p')).toBe(true)