Skip to content

Latest commit

 

History

History
32 lines (22 loc) · 857 Bytes

trigger.md

File metadata and controls

32 lines (22 loc) · 857 Bytes

trigger(eventName)

⚠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 !

Triggers an event on the `Wrapper` DOM node.

trigger takes an optional options object. The properties in the options object are added to the Event.

  • Arguments:

    • {string} eventName
    • {Object} options
  • Example:

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

const clickHandler = sinon.stub()
const wrapper = mount(Foo, {
  propsData: { clickHandler }
})

wrapper.trigger('click')

wrapper.trigger('click', {
  button: 0
})

expect(clickHandler.called).toBe(true)