Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(animations): allow players to be destroyed before initialized #13346

Merged
merged 1 commit into from Dec 15, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
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