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.
attributes
Renvoie l'objet attribut de nœud DOM Wrapper. Si la key est fournie, la valeur de la key sera renvoyée.
Arguments:
{string} keyfacultatif
Retours:
{[attribute: string]: any} | stringExample:
import { mount } from '@vue/test-utils'
import Foo from './Foo.vue'
const wrapper = mount(Foo)
expect(wrapper.attributes().id).toBe('foo')
expect(wrapper.attributes('id')).toBe('foo')