fix(animations): allow animations to be destroyed manually (#12719)

Closes #12456
Closes #12719
This commit is contained in:
Matias Niemelä
2016-11-08 16:21:28 -08:00
committed by vikerman
parent ad3bf6c54f
commit fe35bc34f6
8 changed files with 175 additions and 121 deletions

View File

@ -7,14 +7,13 @@
*/
import {AnimationPlayer} from '@angular/core';
import {isPresent} from './facade/lang';
export class MockAnimationPlayer implements AnimationPlayer {
private _onDoneFns: Function[] = [];
private _onStartFns: Function[] = [];
private _finished = false;
private _destroyed = false;
private _started: boolean = false;
private _started = false;
public parentPlayer: AnimationPlayer = null;
@ -27,9 +26,6 @@ export class MockAnimationPlayer implements AnimationPlayer {
this._onDoneFns.forEach(fn => fn());
this._onDoneFns = [];
if (!isPresent(this.parentPlayer)) {
this.destroy();
}
}
}
@ -56,7 +52,12 @@ export class MockAnimationPlayer implements AnimationPlayer {
finish(): void { this._onFinish(); }
reset(): void { this.log.push('reset'); }
reset(): void {
this.log.push('reset');
this._destroyed = false;
this._finished = false;
this._started = false;
}
destroy(): void {
if (!this._destroyed) {