📅  最后修改于: 2022-03-11 15:03:14.048000             🧑  作者: Mango
const stub = sinon.stub()
const wrapper = mount(ParentComponent)
// just a simple assertion that your parent component's handler for input event was called
wrapper.setMethods({ methodToTest: sub })
// you can pass a component in `find()` method then trigger the component's event
wrapper.find(ChildComponent).trigger('input')
// assert if the listener was called
expect(stub.called).tobeTruthy()