diff options
author | Saivan <savian@me.com> | 2018-05-30 01:48:35 +1000 |
---|---|---|
committer | Saivan <savian@me.com> | 2018-05-30 01:48:35 +1000 |
commit | b3317d7150ce875e7ad772e40ad700d37839da2f (patch) | |
tree | 68570d076e397741604152210933bcece8bd1eee /spec | |
parent | fe0360187801b6a71281fe682e1f3cea49eda35b (diff) | |
download | svg.js-b3317d7150ce875e7ad772e40ad700d37839da2f.tar.gz svg.js-b3317d7150ce875e7ad772e40ad700d37839da2f.zip |
Got looping working with only a single wait
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/runner.js | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/spec/runner.js b/spec/spec/runner.js index ce64c23..126ece4 100644 --- a/spec/spec/runner.js +++ b/spec/spec/runner.js @@ -167,6 +167,37 @@ describe('SVG.Runner', function () { expect(runner.step(SVG.defaults.timeline.duration)).toBe(true) }) + + // step in time + it('steps forward a certain time', function () { + var spy = jasmine.createSpy('stepper') + var r = new SVG.Runner(1000).loop(10, false, 100) + r.queue(null, spy) + + r.step(300) // should be 0.3s + expect(spy).toHaveBeenCalledWith(0.3) + expect(r._loopsDone).toBe(0) + + r.step(300) // should be 0.6s + expect(spy).toHaveBeenCalledWith(0.6) + expect(r._loopsDone).toBe(0) + + r.step(600) // should be 0.1s + expect(spy).toHaveBeenCalledWith(0.1) + expect(r._loopsDone).toBe(1) + + r.step(-300) // should be 0.9s + expect(spy).toHaveBeenCalledWith(0.9) + expect(r._loopsDone).toBe(0) + + r.step(2000) // should be 0.7s + expect(spy).toHaveBeenCalledWith(0.7) + expect(r._loopsDone).toBe(2) + + r.step(-2000) // should be 0.9s + expect(spy).toHaveBeenCalledWith(0.9) + expect(r._loopsDone).toBe(0) + }) }) describe('active()', function () { |