diff options
author | Rémi Tétreault <tetreault.remi@gmail.com> | 2016-10-17 15:58:34 -0400 |
---|---|---|
committer | Rémi Tétreault <tetreault.remi@gmail.com> | 2016-10-17 15:58:34 -0400 |
commit | 7db574d979e02369bdfcfe2a0f90a60380d63f68 (patch) | |
tree | 82fd0c962e761f46b600a4a206c27bd52092e42b /spec | |
parent | d29ee51f9f3deaae12410bbfcd4f7827937146ed (diff) | |
download | svg.js-7db574d979e02369bdfcfe2a0f90a60380d63f68.tar.gz svg.js-7db574d979e02369bdfcfe2a0f90a60380d63f68.zip |
Make the tests of timeToPos() and posToTime() easier to understand
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/fx.js | 12 |
1 files changed, 6 insertions, 6 deletions
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 ) }) }) |