-
Notifications
You must be signed in to change notification settings - Fork 24.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(animations): implement getPosition in browser animation builder (#…
- Loading branch information
1 parent
6cc9ab1
commit ca08625
Showing
4 changed files
with
54 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
/** | ||
* @license | ||
* Copyright Google LLC All Rights Reserved. | ||
* | ||
* Use of this source code is governed by an MIT-style license that can be | ||
* found in the LICENSE file at https://angular.io/license | ||
*/ | ||
import {fakeAsync} from '@angular/core/testing'; | ||
import {NoopAnimationPlayer} from '../src/animations'; | ||
import {AnimationGroupPlayer} from '../src/players/animation_group_player'; | ||
|
||
|
||
describe('AnimationGroupPlayer', () => { | ||
it('should getPosition of an empty group', fakeAsync(() => { | ||
const players: NoopAnimationPlayer[] = []; | ||
const groupPlayer = new AnimationGroupPlayer(players); | ||
expect(groupPlayer.getPosition()).toBe(0); | ||
})); | ||
|
||
it('should getPosition of a single player in a group', fakeAsync(() => { | ||
const player = new NoopAnimationPlayer(5, 5); | ||
player.setPosition(0.2); | ||
const players = [player]; | ||
const groupPlayer = new AnimationGroupPlayer(players); | ||
expect(groupPlayer.getPosition()).toBe(0.2); | ||
})); | ||
|
||
it('should getPosition based on the longest player in the group', fakeAsync(() => { | ||
const longestPlayer = new NoopAnimationPlayer(5, 5); | ||
longestPlayer.setPosition(0.2); | ||
const players = [ | ||
new NoopAnimationPlayer(1, 4), | ||
new NoopAnimationPlayer(4, 1), | ||
new NoopAnimationPlayer(7, 0), | ||
longestPlayer, | ||
new NoopAnimationPlayer(1, 1), | ||
]; | ||
const groupPlayer = new AnimationGroupPlayer(players); | ||
expect(groupPlayer.getPosition()).toBe(0.2); | ||
})); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters