fix(directive): releasing $timeout on remove() #27
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This commit uses the Angular $timeout service to clear the timer (set by the growl directives link method) when the
$growlNotification.remove()
method is called. Ensuring this removal propagates and is respected by Angular's digest loop.Solution:
Replace
with
to ensure the timer is cleaned up within Angular.
Problem:
When testing an Angular application with Protractor there is a default configuration
ignoreSynchronization
that is set to false - this means that Protractor will watch Angular's services$http
,$timeout
etc. and wait until promises are resolved before continuing the test. In the current implementation the $timeout set in the directiveis never actually cleared when
$growlNotification.remove()
is called - this means end to end tests will wait until thettl
has been completed and the$timeout
is cleaned up automatically (it is worth noting the call to$animate
works fine so it actually looks like the notification is removed!).