diff options
author | Rémi Tétreault <tetreault.remi@gmail.com> | 2017-03-04 18:50:38 -0500 |
---|---|---|
committer | Rémi Tétreault <tetreault.remi@gmail.com> | 2017-03-07 20:42:56 -0500 |
commit | 927aeaeafa4e3bf21390b86f1a5087b49558db49 (patch) | |
tree | abd04b21875eb5473e446fd1ba9410c3f1a248aa /spec | |
parent | 40e103fa1acf93e0f59703da96a9c5200b14ca77 (diff) | |
download | svg.js-927aeaeafa4e3bf21390b86f1a5087b49558db49.tar.gz svg.js-927aeaeafa4e3bf21390b86f1a5087b49558db49.zip |
Have stop be called after each test of the fx module
This change should prevent some animations to keep running in
the background while the tests that spawned them is long done.
Introducing this change made some tests fail, they were also fixed.
Diffstat (limited to 'spec')
-rw-r--r-- | spec/spec/fx.js | 29 |
1 files changed, 18 insertions, 11 deletions
diff --git a/spec/spec/fx.js b/spec/spec/fx.js index a1106cb..da09cc6 100644 --- a/spec/spec/fx.js +++ b/spec/spec/fx.js @@ -11,6 +11,8 @@ describe('FX', function() { afterEach(function() { jasmine.clock().uninstall() + + fx.stop(false, true) }) @@ -970,7 +972,12 @@ describe('FX', function() { it('when the first element of the queue is a function, it should execute it', function() { var called = false - fx.queue(function(){ called=true; expect(this).toBe(fx) }).dequeue() + fx.queue(function(){ + called = true + expect(this).toBe(fx) + this.dequeue() + }).dequeue() + expect(called).toBe(true) }) @@ -2201,17 +2208,17 @@ describe('FX', function() { describe('add()', function() { it('adds to animations obj by default', function() { - fx.add('x', 20) - expect(fx.situation.animations.x).toBe(20) + fx.add('x', new SVG.Number(20)) + expect(fx.situation.animations.x.value).toBe(20) }) it('adds to specified obj', function() { - fx.add('x', 20, 'animations') - fx.add('x', 20, 'attrs') - fx.add('x', 20, 'styles') - expect(fx.situation.animations.x).toBe(20) - expect(fx.situation.attrs.x).toBe(20) - expect(fx.situation.styles.x).toBe(20) + fx.add('x', new SVG.Number(20), 'animations') + fx.add('x', new SVG.Number(20), 'attrs') + fx.add('x', new SVG.Number(20), 'styles') + expect(fx.situation.animations.x.value).toBe(20) + expect(fx.situation.attrs.x.value).toBe(20) + expect(fx.situation.styles.x.value).toBe(20) }) }) @@ -2444,7 +2451,7 @@ describe('FX', function() { expect(fx.add).not.toHaveBeenCalled() }) }) - + describe('transform()', function() { it('returns itself when no valid transformation was found', function() { expect(fx.transform({})).toBe(fx) @@ -2625,4 +2632,4 @@ describe('SVG.MorphObj', function() { expect(obj.valueOf()).toBe('Hello') expect(obj + 'World').toBe('HelloWorld') }) -})
\ No newline at end of file +}) |