incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject [2/2] js commit: [CB-462] added a watchaccel test for frequency callback invocation
Date Fri, 18 May 2012 21:31:42 GMT
[CB-462] added a watchaccel test for frequency callback invocation


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/commit/47d1ee75
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/tree/47d1ee75
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/diff/47d1ee75

Branch: refs/heads/462
Commit: 47d1ee758cc1b9ca67effc91b4301482ed484411
Parents: 0463f1b
Author: Fil Maj <maj.fil@gmail.com>
Authored: Fri May 18 13:42:24 2012 -0700
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Fri May 18 13:42:24 2012 -0700

----------------------------------------------------------------------
 test/test.accelerometer.js |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-js/blob/47d1ee75/test/test.accelerometer.js
----------------------------------------------------------------------
diff --git a/test/test.accelerometer.js b/test/test.accelerometer.js
index f424938..085fa74 100644
--- a/test/test.accelerometer.js
+++ b/test/test.accelerometer.js
@@ -117,6 +117,26 @@ describe("accelerometer", function () {
                     expect(success).toHaveBeenCalled();
                 });
             });
+            it("should fire the success callback on the appropriate interval, not based on
how quickly the framework returns accel objects", function() {
+                var success = jasmine.createSpy();
+                runs(function() {
+                    id = accelerometer.watchAcceleration(success, function(){}, {frequency:250});
+                });
+                waits(25);
+                runs(function() {
+                    callSuccess();
+                    expect(success).not.toHaveBeenCalled();
+                });
+                waits(25);
+                runs(function() {
+                    callSuccess();
+                    expect(success).not.toHaveBeenCalled();
+                });
+                waits(210);
+                runs(function() {
+                    expect(success).toHaveBeenCalled();
+                });
+            });
         });
     });
 


Mime
View raw message