In the reference jasmine test resource, component event(egComponentEvent) registration and handler is done in same component(egEventHandling).
Thus, we are able to test the result after event is fired.
Facing issue to test the results after component event is fired, when event registration and its handler is done in different components.
We are firing a component level event in component 1 and the handler is being invoked in Component 2 ,
We are struggling in testing component event where as component is getting fired but we are not able to see the handler invoked in the Component 2
Kindly help us in getting the correct solution for the below code
$T.createComponent("c:tagr_Tag",attributes,true)
.then(function(component) {
var evt = component.getEvent('componentEvent');
evt.setParam('entity', entity);
evt.fire();
expect(evt.fire()).tobe.(true);
}
Here event is getting fired from tagr_Tag but handler is not getting invoked from different component.
Please help us in arriving to the solution using any approach like spyon or something else.
Thanks in Advance
In the reference jasmine test resource, component event(egComponentEvent) registration and handler is done in same component(egEventHandling). Thus, we are able to test the result after event is fired.
https://github.com/forcedotcom/LightningTestingService/blob/master/lightning-component-tests/test/default/staticresources/jasmineExampleTests.resource
/**
Facing issue to test the results after component event is fired, when event registration and its handler is done in different components.
We are firing a component level event in component 1 and the handler is being invoked in Component 2 ,
We are struggling in testing component event where as component is getting fired but we are not able to see the handler invoked in the Component 2
Kindly help us in getting the correct solution for the below code $T.createComponent("c:tagr_Tag",attributes,true) .then(function(component) { var evt = component.getEvent('componentEvent'); evt.setParam('entity', entity);
evt.fire(); expect(evt.fire()).tobe.(true); }
Here event is getting fired from tagr_Tag but handler is not getting invoked from different component. Please help us in arriving to the solution using any approach like spyon or something else. Thanks in Advance