Skip to content

Files

This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Latest commit

Oct 20, 2017
810e184 · Oct 20, 2017

History

History
26 lines (19 loc) · 663 Bytes

setMethods.md

File metadata and controls

26 lines (19 loc) · 663 Bytes

setMethods(methods)

Fixe les méthodes de l'instance de Vue vm du Wrapper et force la mise à jour sur chaque Wrapper de WrapperArray.

Note : chaque Wrapper doit conenir une instance de Vue.

  • Paramètre :

    • {Object} methods
  • Exemple :

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)