public listenCloseEvt() {
this.renderer.listen(window, 'close', () => {
this.showModal = false;
});
}
I am able to spyOn render.listen but I am unable to reach this.showModal false line on writing unit test.
public listenCloseEvt() {
this.renderer.listen(window, 'close', () => {
this.showModal = false;
});
}
I am able to spyOn render.listen but I am unable to reach this.showModal false line on writing unit test.
If you spy on something the implementation details are lost for that object.
To get to the implementation you'll have to callThrough() to the original implementation on your spy.
Instead of:
spyOn(renderer.listen)
use
spyOn(renderer.listen).and.callThrough()