What I usually do is create a stub and assign an event to the stub. Then fire the click event and check if it was triggered
describe('view interactions', function () { beforeEach(function () { this.clickEventStub = sinon.stub(this, 'clickEvent'); }); afterEach(function () { this.clickEvent.restore(); }); describe('when item is clicked', function () { it('event is fired', function () { this.elem.trigger('click'); expect(this.clickEventStub).toHaveBeenCalled(); }); }); });
source share