From 9165ee80eca0be42970ccbc5470f5541f206f7f3 Mon Sep 17 00:00:00 2001 From: Rémi Tétreault Date: Sun, 5 Mar 2017 20:55:09 -0500 Subject: Make the method dequeue stop the current animation There was a bug in the dequeue method of the FX module. It was not stopping the current animation as it was supposed too. This bug is now fixed. Also, I rewritten the test that @fuzzyma left commented. I changed its implementation to not use the once callback since there seem to be some issues when combining once and dequeue. The method stop was also modified, it now call start only when it's revelant. --- spec/spec/fx.js | 25 +++++++++---------------- 1 file changed, 9 insertions(+), 16 deletions(-) (limited to 'spec') diff --git a/spec/spec/fx.js b/spec/spec/fx.js index da09cc6..de05dcb 100644 --- a/spec/spec/fx.js +++ b/spec/spec/fx.js @@ -981,22 +981,15 @@ describe('FX', function() { expect(called).toBe(true) }) - /*it('should stop the currently running animation when there is one', function() { - var called = false - - fx.start().once(0.5, function(pos, eased) { - console.warn('asds') - expect(pos).toBeCloseTo(0.5) - this.fx.dequeue() - })//.queue(function(){ called=true; expect(this).toBe(fx) }) - - //jasmine.clock().tick(125) - //fx.step() - //expect(called).toBe(false) - //jasmine.clock().tick(125) - //fx.step() - //expect(called).toBe(true) - })*/ + it('should stop the currently running animation when there is one', function() { + fx.start() + expect(fx.active).toBe(true) + fx.queue(function() { + expect(this.active).toBe(false) + this.dequeue() + }) + fx.dequeue() + }) }) -- cgit v1.2.3