From: Rémi Tétreault Date: Mon, 17 Oct 2016 19:58:34 +0000 (-0400) Subject: Make the tests of timeToPos() and posToTime() easier to understand X-Git-Tag: 2.3.6~10^2~2 X-Git-Url: https://source.dussan.org/?a=commitdiff_plain;h=7db574d979e02369bdfcfe2a0f90a60380d63f68;p=svg.js.git Make the tests of timeToPos() and posToTime() easier to understand --- diff --git a/spec/spec/fx.js b/spec/spec/fx.js index e848862..e71f449 100644 --- a/spec/spec/fx.js +++ b/spec/spec/fx.js @@ -39,7 +39,7 @@ describe('FX', function() { describe('timeToPos()', function() { it('converts a timestamp to a progress', function() { - expect(fx.timeToPos(fx.situation.start+fx.situation.duration/2)).toBe(0.5) + expect(fx.timeToPos( fx.situation.start + fx.situation.duration*0.5 )).toBe(0.5) }) it('should take speed into consideration', function() { @@ -47,17 +47,17 @@ describe('FX', function() { spd = 4 fx.speed(spd) - expect(fx.timeToPos(fx.situation.start+(fx.situation.duration/spd)/2)).toBe(0.5) + expect(fx.timeToPos( fx.situation.start + (fx.situation.duration/spd)*0.5 )).toBe(0.5) spd = 0.5 fx.speed(spd) - expect(fx.timeToPos(fx.situation.start+(fx.situation.duration/spd)/4)).toBe(0.25) + expect(fx.timeToPos( fx.situation.start + (fx.situation.duration/spd)*0.25 )).toBe(0.25) }) }) describe('posToTime()', function() { it('converts a progress to a timestamp', function() { - expect(fx.posToTime(0.5)).toBe(fx.situation.start+fx.situation.duration/2) + expect(fx.posToTime(0.5)).toBe( fx.situation.start + fx.situation.duration*0.5 ) }) it('should take speed into consideration', function() { @@ -65,11 +65,11 @@ describe('FX', function() { spd = 4 fx.speed(spd) - expect(fx.posToTime(0.5)).toBe(fx.situation.start+(fx.situation.duration/spd)/2) + expect(fx.posToTime(0.5)).toBe( fx.situation.start + (fx.situation.duration/spd)*0.5 ) spd = 0.5 fx.speed(spd) - expect(fx.posToTime(0.25)).toBe(fx.situation.start+(fx.situation.duration/spd)/4) + expect(fx.posToTime(0.25)).toBe( fx.situation.start + (fx.situation.duration/spd)*0.25 ) }) })