Fixes 2159 #2174

Merged
merged 4 commits into from Dec 19, 2011
Jump to file or symbol
Failed to load files and symbols.
+61 −1
Diff settings

Always

Just for now

View
@@ -182,6 +182,21 @@ Returns true if the animation is running.
+Fx Method: isPaused {#Fx:isPaused}
+------------------------------------
+
+Returns true if the animation is paused. You can use this to check if you need to call [Fx:resume](#Fx:resume) to resume an animation instead of restarting it.
+
+### Syntax:
+
+ var isPaused = myFx.isPaused();
+
+### Returns:
+
+* (*boolean*) - If the animation is paused, returns true. Otherwise, returns false.
+
+
+
[Fx]: #Fx
[Fx.Transitions]: /core/Fx/Fx.Transitions
[Fx.Transitions:sine]: /core/Fx/Fx.Transitions#Fx-Transitions:sine
View
@@ -130,13 +130,17 @@ var Fx = this.Fx = new Class({
},
resume: function(){
- if ((this.frame < this.frames) && !this.isRunning()) pushInstance.call(this, this.options.fps);
+ if (this.isPaused()) pushInstance.call(this, this.options.fps);
return this;
},
isRunning: function(){
var list = instances[this.options.fps];
return list && list.contains(this);
+ },
+
+ isPaused: function(){
+ return (this.frame < this.frames) && !this.isRunning();
}
});
View
@@ -0,0 +1,30 @@
+
+describe('Fx', function(){
+
+ beforeEach(function(){
+ this.clock = sinon.useFakeTimers();
+ });
+
+ afterEach(function(){
+ this.clock.reset();
+ this.clock.restore();
+ });
+
+ it('should return the paused state', function(){
+ var fx = new Fx({
+ duration: 50
+ }).start();
+
+ expect(fx.isPaused()).toEqual(false);
+
+ this.clock.tick(30);
+ fx.pause();
+
+ expect(fx.isPaused()).toEqual(true);
+
+ fx.resume();
+ this.clock.tick(60);
+ expect(fx.isPaused()).toEqual(false);
+ });
+
+});
View
@@ -33,6 +33,10 @@ Configuration.presets = {
sets: ['core-1.3-base', 'core-1.3-client', 'core-1.4-base-nocompat', 'core-1.4-client'],
source: ['1.4nocompat']
},
+ 'core-1.5': {
+ sets: ['1.2', 'core-1.3-base', 'core-1.3-client', 'core-1.4-base', 'core-1.4-client', 'core-1.5-base'],
+ source: ['core-1.4-base', 'core-1.4-client']
+ },
'core-2.0': {
sets: ['core-2.0-base', 'core-2.0-client'],
source: ['core-2.0-base', 'core-2.0-client']
@@ -114,6 +118,13 @@ Configuration.sets = {
]
},
+ 'core-1.5-base': {
+ path: '1.5base/',
+ files: [
+ 'Fx/Fx'
+ ]
+ },
+
'core-2.0-base': {
path: '2.0base/',
files: [