Skip to content

Commit

Permalink
fix(platform-browser): update started state on reset
Browse files Browse the repository at this point in the history
This commit fixes the state of variable _started on call of reset method.

Resolves #18140
  • Loading branch information
iRealNirmal committed Apr 15, 2021
1 parent bd34bc9 commit 3408433
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
Expand Up @@ -104,6 +104,7 @@ export class RendererAnimationPlayer implements AnimationPlayer {

reset(): void {
this._command('reset');
this._started = false;
}

setPosition(p: number): void {
Expand Down
Expand Up @@ -72,7 +72,7 @@ import {el} from '../../testing/src/browser_util';
const player = cmp.build();

let started = false;
player.onStart(() => started = true);
player.onStart(() => started = false);

let finished = false;
player.onDone(() => finished = true);
Expand All @@ -83,24 +83,38 @@ import {el} from '../../testing/src/browser_util';
player.init();
flushMicrotasks();
expect(started).toBeFalsy();
expect(player.hasStarted()).toBeFalsy();
expect(finished).toBeFalsy();
expect(destroyed).toBeFalsy();

player.play();
flushMicrotasks();
expect(started).toBeTruthy();
expect(player.hasStarted()).toBeTruthy();
expect(finished).toBeFalsy();
expect(destroyed).toBeFalsy();

player.play();
player.reset();
flushMicrotasks();
expect(started).toBeFalsy();
expect(player.hasStarted()).toBeFalsy();
expect(finished).toBeTruthy();
expect(destroyed).toBeFalsy();

player.finish();
flushMicrotasks();
started = player.hasStarted();
expect(started).toBeTruthy();
expect(player.hasStarted()).toBeTruthy();
expect(finished).toBeTruthy();
expect(destroyed).toBeFalsy();

player.destroy();
flushMicrotasks();
started = player.hasStarted();
expect(started).toBeTruthy();
expect(player.hasStarted()).toBeTruthy();
expect(finished).toBeTruthy();
expect(destroyed).toBeTruthy();
}));
Expand Down

0 comments on commit 3408433

Please sign in to comment.