From 2f49a23d64a805b2fcd9d4b810fb20344d106d37 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Matias=20Niemel=C3=A4?= Date: Tue, 15 Jan 2019 16:01:23 -0800 Subject: [PATCH] test(animations): fix unit-based delays within the animation DSL (#28993) Closes #24291 PR Close #28993 --- .../browser/test/dsl/animation_spec.ts | 34 +++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/packages/animations/browser/test/dsl/animation_spec.ts b/packages/animations/browser/test/dsl/animation_spec.ts index 21071dec8f..4fe716c808 100644 --- a/packages/animations/browser/test/dsl/animation_spec.ts +++ b/packages/animations/browser/test/dsl/animation_spec.ts @@ -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', () => {