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.

O método contains

Afirma que todo wrapper (envolvedor) dentro do WrapperArray contém o seletor.

Use qualquer seletor válido.

  • Argumentos:

    • {string|Component} selector
  • Returna: {boolean}

  • Exemplo:

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

const wrapper = shallowMount(Foo)
const divArray = wrapper.findAll('div')
expect(divArray.contains('p')).toBe(true)
expect(divArray.contains(Bar)).toBe(true)