Skip to content

Support testing emitted events #6

@asselin

Description

@asselin

@callumacrae FYI, I'm working on an enhancement to allow a unit test to specify event handlers for a component under test so that you can test that a component correctly emits events.

I'm basically trying to get something like this working:

  it('should emit an event', () => {
    var spy = sinon.spy();

    // eslint-disable-next-line no-unused-vars
    const HelloComponent = mount(Hello, {}, '', { someEvent: spy });
    // Do something that should make HelloComponent emit 'someEvent'

    spy.should.have.been.calledOnce;
  });

I hope to have a PR today, but if you have any feedback, I'm happy to hear it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions