I am working on a directive that conditionally listens for events, and logs accordingly. I'm having an issue with the unregister function, but it seems only during test execution. In product code, calling the listen function result correctly unregisters the event. For example, the following code will deregister the listener outside of a test (Jasmine):
this.listener = this.renderer.listen(target, 'click', this.onClick);
this.listener();
I've distilled the problem down to two Plunkers, one that counts the
clicks in tests, and one that counts the
clicks on rendered code. Both plunkers are using the same component/directive code.
Any help is appreciated. Thanks in advance.