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.

props()

Wrappervm プロパティの props オブジェクトを返します。

Wrapper には Vue インスタンスを含む必要があることに注意してください

  • 戻り値: {[prop: string]: any}

  • 例:

import { mount } from '@vue/test-utils'
import { expect } from 'chai'
import Foo from './Foo.vue'

const wrapper = mount(Foo, {
  propsData: {
    bar: 'baz'
  }
})
expect(wrapper.props().bar).toBe('baz')