This repository has been archived by the owner on Aug 1, 2019. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
Aura Events
Yuriy Sannikov edited this page Jul 23, 2017
·
1 revision
In this example mocha-aura provides simple factory for events. Then actual controller code has been called against mock event instance. For this particular example calculateWaitlistCount helper method was mocked by sinon.stub(helper, 'calculateWaitlistCount');
it('should call helper calculateWaitlistCount for numberOfGuests', function() {
const value = 'test value';
const event = eventFactory({fieldId : 'numberOfGuests', value});
ctl.handleFieldUpdateEvent(component, event, helper);
expect(helper.calculateWaitlistCount).to.have.been.called;
});
handleFieldUpdateEvent: function(component, event, helper) {
var params = event.getParams();
if (params.fieldId === 'rsvpStatus') {
helper.updateRSVPPane(component, params.value);
helper.checkSelection(component);
}
if (params.fieldId === 'numberOfGuests') {
helper.calculateWaitlistCount(component);
}
},