Skip to content

Commit

Permalink
fixup! fix(platform-browser): update started state on reset
Browse files Browse the repository at this point in the history
  • Loading branch information
iRealNirmal committed Apr 15, 2021
1 parent d621a69 commit 5c0c9ed
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
Expand Up @@ -104,7 +104,7 @@ export class RendererAnimationPlayer implements AnimationPlayer {

reset(): void {
this._command('reset');
this._started = true;
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(noop);
player.onStart(() => started = false);

let finished = false;
player.onDone(() => finished = true);
Expand All @@ -82,37 +82,39 @@ import {el} from '../../testing/src/browser_util';

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

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

player.play();
player.reset();
flushMicrotasks();
started = player.hasStarted();
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 5c0c9ed

Please sign in to comment.