Skip to content

Latest commit

 

History

History
27 lines (19 loc) · 874 Bytes

setMethods.md

File metadata and controls

27 lines (19 loc) · 874 Bytes

setMethods(methods)

⚠Cette page est actuellement en cours de traduction française. Vous pouvez repasser plus tard ou participer à la traduction de celle-ci dès maintenant !

Sets `Wrapper` `vm` methods and forces update on each `Wrapper` in `WrapperArray`.

Note every Wrapper must contain a Vue instance.

  • Arguments:

    • {Object} methods
  • Example:

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

const wrapper = mount(Foo)
const barArray = wrapper.findAll(Bar)
const clickMethodStub = sinon.stub()

barArray.setMethods({ clickMethod: clickMethodStub })
barArray.at(0).trigger('click')
expect(clickMethodStub.called).toBe(true)