Skip to content

Commit

Permalink
fix(animations): allow players to be destroyed before initialized (#1…
Browse files Browse the repository at this point in the history
…3346)

Closes #13293
Closes #13346
  • Loading branch information
matsko authored and chuckjaz committed Dec 20, 2016
1 parent 355c537 commit b36f4bc
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,11 @@ export class WebAnimationsPlayer implements AnimationPlayer {
this._started = false;
}

private _resetDomPlayerState() { this._player.cancel(); }
private _resetDomPlayerState() {
if (this._player) {
this._player.cancel();
}
}

restart(): void {
this.reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,12 @@ export function main() {
expect(data['keyframes']).toEqual([{opacity: '0.5'}, {opacity: '1'}]);
});

it('should allow the player to be destroyed before it is initialized', () => {
const elm = el('<div></div>');
const player = new ExtendedWebAnimationsPlayer(elm, [], {});
expect(() => { player.destroy(); }).not.toThrowError();
});

describe('previousStyle', () => {
it('should merge keyframe styles based on the previous styles passed in when the player has finished its operation',
() => {
Expand Down

0 comments on commit b36f4bc

Please sign in to comment.