Skip to content

Latest commit

 

History

History
25 lines (18 loc) · 508 Bytes

props.md

File metadata and controls

25 lines (18 loc) · 508 Bytes

props([key])

Return Wrapper vm props object. If key is provided, the value for the key will be returned.

Note the Wrapper must contain a Vue instance.

  • Arguments:

    • {string} key optional
  • Returns: {[prop: string]: any} | any

  • Example:

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

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