diff --git a/core/src/utils/animation/animation.ts b/core/src/utils/animation/animation.ts index dc4c99d499..0a43a2c0b5 100644 --- a/core/src/utils/animation/animation.ts +++ b/core/src/utils/animation/animation.ts @@ -292,7 +292,7 @@ export const createAnimation = () => { if (_fill !== undefined) { return _fill; } if (parentAnimation) { return parentAnimation.getFill(); } - return undefined; + return 'both'; }; /** @@ -303,7 +303,7 @@ export const createAnimation = () => { if (_direction !== undefined) { return _direction; } if (parentAnimation) { return parentAnimation.getDirection(); } - return undefined; + return 'normal'; }; @@ -315,7 +315,7 @@ export const createAnimation = () => { if (_easing !== undefined) { return _easing; } if (parentAnimation) { return parentAnimation.getEasing(); } - return undefined; + return 'linear'; }; /** @@ -327,7 +327,7 @@ export const createAnimation = () => { if (_duration !== undefined) { return _duration; } if (parentAnimation) { return parentAnimation.getDuration(); } - return undefined; + return 0; }; /** @@ -337,7 +337,7 @@ export const createAnimation = () => { if (_iterations !== undefined) { return _iterations; } if (parentAnimation) { return parentAnimation.getIterations(); } - return undefined; + return 1; }; /** @@ -348,7 +348,7 @@ export const createAnimation = () => { if (_delay !== undefined) { return _delay; } if (parentAnimation) { return parentAnimation.getDelay(); } - return undefined; + return 0; }; /** diff --git a/core/src/utils/animation/test/animation.spec.ts b/core/src/utils/animation/test/animation.spec.ts index a6f3fcf79a..91b8c8e0ae 100644 --- a/core/src/utils/animation/test/animation.spec.ts +++ b/core/src/utils/animation/test/animation.spec.ts @@ -151,17 +151,17 @@ describe('Animation Class', () => { animation = createAnimation(); }); - it('should get undefined when easing not set', () => { - expect(animation.getEasing()).toEqual(undefined); + it('should get "linear" when easing not set', () => { + expect(animation.getEasing()).toEqual("linear"); }); it('should get parent easing when child easing is not set', () => { const childAnimation = createAnimation(); animation .addAnimation(childAnimation) - .easing('linear'); + .easing('ease-in-out'); - expect(childAnimation.getEasing()).toEqual('linear'); + expect(childAnimation.getEasing()).toEqual('ease-in-out'); }); it('should get prefer child easing over parent easing', () => { @@ -185,8 +185,8 @@ describe('Animation Class', () => { expect(animation.getEasing()).toEqual('ease-in-out'); }); - it('should get undefined when duration not set', () => { - expect(animation.getDuration()).toEqual(undefined); + it('should get 0 when duration not set', () => { + expect(animation.getDuration()).toEqual(0); }); it('should get parent duration when child duration is not set', () => { @@ -209,8 +209,8 @@ describe('Animation Class', () => { expect(childAnimation.getDuration()).toEqual(500); }); - it('should get undefined when delay not set', () => { - expect(animation.getDelay()).toEqual(undefined); + it('should get 0 when delay not set', () => { + expect(animation.getDelay()).toEqual(0); }); it('should get parent delay when child delay is not set', () => { @@ -233,8 +233,8 @@ describe('Animation Class', () => { expect(childAnimation.getDelay()).toEqual(500); }); - it('should get undefined when iterations not set', () => { - expect(animation.getIterations()).toEqual(undefined); + it('should get 1 when iterations not set', () => { + expect(animation.getIterations()).toEqual(1); }); it('should get parent iterations when child iterations is not set', () => { @@ -257,17 +257,17 @@ describe('Animation Class', () => { expect(childAnimation.getIterations()).toEqual(2); }); - it('should get undefined when fill not set', () => { - expect(animation.getFill()).toEqual(undefined); + it('should get "both" when fill not set', () => { + expect(animation.getFill()).toEqual("both"); }); it('should get parent fill when child fill is not set', () => { const childAnimation = createAnimation(); animation .addAnimation(childAnimation) - .fill('both'); + .fill('forwards'); - expect(childAnimation.getFill()).toEqual('both'); + expect(childAnimation.getFill()).toEqual('forwards'); }); it('should get prefer child fill over parent fill', () => { @@ -281,8 +281,8 @@ describe('Animation Class', () => { expect(childAnimation.getFill()).toEqual('none'); }); - it('should get undefined when direction not set', () => { - expect(animation.getDirection()).toEqual(undefined); + it('should get "normal" when direction not set', () => { + expect(animation.getDirection()).toEqual('normal'); }); it('should get parent direction when child direction is not set', () => { diff --git a/core/src/utils/animation/test/multiple/index.html b/core/src/utils/animation/test/multiple/index.html index 46cf9c7bb0..a0e0c8cd14 100644 --- a/core/src/utils/animation/test/multiple/index.html +++ b/core/src/utils/animation/test/multiple/index.html @@ -123,6 +123,7 @@ rootAnimation .addAnimation([animationA, animationB, animationC]) + .fill('none') .onFinish(() => { const ev = new CustomEvent('ionAnimationFinished', { detail: 'AnimationRootFinished' }); squareA.dispatchEvent(ev);