Skip to content
This repository
Browse code

Merge pull request #2174 from ibolmo/fix-2150-fx-isPaused

Fixes 2159
  • Loading branch information...
commit c6113b9d0c7d244d833865d3d30df6383a14414e 2 parents d0e5708 + cb26dd1
Olmo Maldonado authored December 18, 2011
15  Docs/Fx/Fx.md
Source Rendered
@@ -182,6 +182,21 @@ Returns true if the animation is running.
182 182
 
183 183
 
184 184
 
  185
+Fx Method: isPaused {#Fx:isPaused}
  186
+------------------------------------
  187
+
  188
+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.
  189
+
  190
+### Syntax:
  191
+
  192
+	var isPaused = myFx.isPaused();
  193
+
  194
+### Returns:
  195
+
  196
+* (*boolean*) - If the animation is paused, returns true. Otherwise, returns false.
  197
+
  198
+
  199
+
185 200
 [Fx]: #Fx
186 201
 [Fx.Transitions]: /core/Fx/Fx.Transitions
187 202
 [Fx.Transitions:sine]: /core/Fx/Fx.Transitions#Fx-Transitions:sine
6  Source/Fx/Fx.js
@@ -130,13 +130,17 @@ var Fx = this.Fx = new Class({
130 130
 	},
131 131
 
132 132
 	resume: function(){
133  
-		if ((this.frame < this.frames) && !this.isRunning()) pushInstance.call(this, this.options.fps);
  133
+		if (this.isPaused()) pushInstance.call(this, this.options.fps);
134 134
 		return this;
135 135
 	},
136 136
 
137 137
 	isRunning: function(){
138 138
 		var list = instances[this.options.fps];
139 139
 		return list && list.contains(this);
  140
+	},
  141
+
  142
+	isPaused: function(){
  143
+		return (this.frame < this.frames) && !this.isRunning();
140 144
 	}
141 145
 
142 146
 });
30  Specs/1.5base/Fx/Fx.js
... ...
@@ -0,0 +1,30 @@
  1
+
  2
+describe('Fx', function(){
  3
+
  4
+	beforeEach(function(){
  5
+		this.clock = sinon.useFakeTimers();
  6
+	});
  7
+
  8
+	afterEach(function(){
  9
+		this.clock.reset();
  10
+		this.clock.restore();
  11
+	});
  12
+
  13
+	it('should return the paused state', function(){
  14
+		var fx = new Fx({
  15
+			duration: 50
  16
+		}).start();
  17
+
  18
+		expect(fx.isPaused()).toEqual(false);
  19
+
  20
+		this.clock.tick(30);
  21
+		fx.pause();
  22
+
  23
+		expect(fx.isPaused()).toEqual(true);
  24
+
  25
+		fx.resume();
  26
+		this.clock.tick(60);
  27
+		expect(fx.isPaused()).toEqual(false);
  28
+	});
  29
+
  30
+});
11  Specs/Configuration.js
@@ -33,6 +33,10 @@ Configuration.presets = {
33 33
 		sets: ['core-1.3-base', 'core-1.3-client', 'core-1.4-base-nocompat', 'core-1.4-client'],
34 34
 		source: ['1.4nocompat']
35 35
 	},
  36
+	'core-1.5': {
  37
+		sets: ['1.2', 'core-1.3-base', 'core-1.3-client', 'core-1.4-base', 'core-1.4-client', 'core-1.5-base'],
  38
+		source: ['core-1.4-base', 'core-1.4-client']
  39
+	},
36 40
 	'core-2.0': {
37 41
 		sets: ['core-2.0-base', 'core-2.0-client'],
38 42
 		source: ['core-2.0-base', 'core-2.0-client']
@@ -114,6 +118,13 @@ Configuration.sets = {
114 118
 		]
115 119
 	},
116 120
 
  121
+	'core-1.5-base': {
  122
+		path: '1.5base/',
  123
+		files: [
  124
+			'Fx/Fx'
  125
+		]
  126
+	},
  127
+
117 128
 	'core-2.0-base': {
118 129
 		path: '2.0base/',
119 130
 		files: [

0 notes on commit c6113b9

Please sign in to comment.
Something went wrong with that request. Please try again.