Skip to content

Instantly share code, notes, and snippets.

@yury-sannikov
Last active September 22, 2017 18:04
Show Gist options
  • Save yury-sannikov/81a22ac663651bc46f910e36f481842e to your computer and use it in GitHub Desktop.
Save yury-sannikov/81a22ac663651bc46f910e36f481842e to your computer and use it in GitHub Desktop.
@testMethod('handleFieldUpdatedEvent should exit if event secondaryGroup does not match')
@inject('cmpSecondaryGroup', 'eventSecondaryGroup', null)
@testMethod('handleFieldUpdatedEvent should call updateFieldVisibility')
@inject('secondaryGroup', 'secondaryGroup', null)
handleFieldUpdatedEvent(secondaryGroup, eventSecondaryGroup, secondaryIdElements) {
const event = eventFactory({secondaryGroup: eventSecondaryGroup})
const component = componentFactory({secondaryGroup, findMap: {value: [true, true]}})
controller.handleFieldUpdatedEvent(component, event, helper);
if (component.get('v.secondaryGroup') !== event.getParam('secondaryGroup')) {
expect(component.find).not.to.have.been.called;
return;
}
expect(helper.updateFieldVisibility).to.have.callCount(2);
if (secondaryIdElements) {
if (Array.isArray(secondaryIdElements)) {
expect(helper.updateDivVisibility).to.have.callCount(secondaryIdElements.length);
} else {
expect(helper.updateDivVisibility).to.have.been.called;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment