test(animations): fix unit-based delays within the animation DSL (#28993)

Closes #24291

PR Close #28993
This commit is contained in:
Matias Niemelä 2019-01-15 16:01:23 -08:00 committed by Andrew Kushnir
parent f01d1c4c8d
commit ff8e4dddb2
1 changed files with 34 additions and 0 deletions

View File

@ -379,6 +379,40 @@ function createDiv() {
]);
expect(finalPlayer.delay).toEqual(1500);
});
it('should allow a float-based delay value to be used', () => {
let steps: any[] = [
animate('.75s 0.75s', style({width: '300px'})),
];
let players = invokeAnimationSequence(rootElement, steps);
expect(players.length).toEqual(1);
let p1 = players.pop() !;
expect(p1.duration).toEqual(1500);
expect(p1.keyframes).toEqual([
{width: '*', offset: 0},
{width: '*', offset: 0.5},
{width: '300px', offset: 1},
]);
steps = [
style({width: '100px'}),
animate('.5s .5s', style({width: '200px'})),
];
players = invokeAnimationSequence(rootElement, steps);
expect(players.length).toEqual(1);
p1 = players.pop() !;
expect(p1.duration).toEqual(1000);
expect(p1.keyframes).toEqual([
{width: '100px', offset: 0},
{width: '100px', offset: 0.5},
{width: '200px', offset: 1},
]);
});
});
describe('substitutions', () => {