incubator-callback-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fil...@apache.org
Subject spec commit: tweaking CompassHeading tests and adding new constructor tests
Date Sat, 03 Mar 2012 23:18:30 GMT
Updated Branches:
  refs/heads/master ad54f6a30 -> d2427406c


tweaking CompassHeading tests and adding new constructor tests


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/commit/d2427406
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/d2427406
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/d2427406

Branch: refs/heads/master
Commit: d2427406c4850cbbcdbbab1ad9c84ad3663c2cb0
Parents: ad54f6a
Author: Fil Maj <maj.fil@gmail.com>
Authored: Sat Mar 3 15:18:16 2012 -0800
Committer: Fil Maj <maj.fil@gmail.com>
Committed: Sat Mar 3 15:18:16 2012 -0800

----------------------------------------------------------------------
 autotest/tests/compass.tests.js |   20 +++++++++++++++-----
 1 files changed, 15 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/d2427406/autotest/tests/compass.tests.js
----------------------------------------------------------------------
diff --git a/autotest/tests/compass.tests.js b/autotest/tests/compass.tests.js
index 3781397..d8adcbf 100644
--- a/autotest/tests/compass.tests.js
+++ b/autotest/tests/compass.tests.js
@@ -13,12 +13,12 @@ Tests.prototype.CompassTests = function() {
 		expect(9);
 		QUnit.stop(Tests.TEST_TIMEOUT);
 		var win = function(a) {
-			ok(typeof a == 'object', "Heading object returned in getCurrentHeading success callback
should be of type 'object'.");
+			ok(a instanceof CompassHeading, "Heading object returned in getCurrentHeading success
callback should be an instance of CompassHeading.");
 			ok(a.magneticHeading !== null, "Heading object returned in getCurrentHeading success callback
should have an 'magneticHeading' property.");
 			ok(typeof a.magneticHeading == 'number', "Heading object's 'magneticHeading' property
returned in getCurrentHeading success callback should be of type 'number'.");
-			ok(a.trueHeading !== null, "Heading object returned in getCurrentHeading success callback
should have a 'trueHeading' property.");
+			ok(a.trueHeading !== undefined, "Heading object returned in getCurrentHeading success
callback should have a 'trueHeading' property.");
 			ok(typeof a.trueHeading == 'number', "Heading object's 'trueHeading' property returned
in getCurrentHeading success callback should be of type 'number'.");
-			ok(a.headingAccuracy !== null, "Heading object returned in getCurrentHeading success callback
should have a 'headingAccuracy' property.");
+			ok(a.headingAccuracy !== undefined, "Heading object returned in getCurrentHeading success
callback should have a 'headingAccuracy' property.");
 			ok(typeof a.headingAccuracy == 'number', "Heading object's 'headingAccuracy' property
returned in getCurrentHeading success callback should be of type 'number'.");
 			ok(a.timestamp !== null, "Heading object returned in getCurrentHeading success callback
should have a 'timestamp' property.");
 			ok(a.timestamp instanceof Date, "Heading object's 'timestamp' property returned in getCurrentHeading
success callback should be of type 'Date'.");
@@ -51,12 +51,22 @@ Tests.prototype.CompassTests = function() {
     expect(1);
     ok(typeof CompassHeading != 'undefined' && CompassHeading !== null, 'CompassHeading
should not be null');
   });
-  test("Creating a new CompassHeading instance", function() {
-    expect(4);
+  test("Creating a new CompassHeading instance with no parameters", function() {
+    expect(5);
     var h = new CompassHeading();
     equals(h.magneticHeading, null, "CompassHeading instance should have null magneticHeading
property by default");
     equals(h.trueHeading, null, "CompassHeading instance should have null trueHeading property
by default");
     equals(h.headingAccuracy, null, "CompassHeading instance should have null headingAccuracy
property by default");
     ok(h.timestamp !== null, "CompassHeading instance should have timestamp that is not null
by default");
+    ok(h.timestamp instanceof Date, "CompassHeading instance should have timestamp that is
an instance of a Date object.");
+  });
+  test("Creating a new CompassHeading instance with parameters", function() {
+    expect(5);
+    var h = new CompassHeading(1,2,3,4);
+    equals(h.magneticHeading, 1, "CompassHeading instance should have specified magneticHeading.");
+    equals(h.trueHeading, 2, "CompassHeading instance should have specified trueHeading.");
+    equals(h.headingAccuracy, 3, "CompassHeading instance should have specified headingAccuracy.");
+    equals(h.timestamp.valueOf(), 4, "CompassHeading instance should have specified timestamp
cast as a Date object");
+    ok(h.timestamp instanceof Date, "CompassHeading instance should have timestamp that is
an instance of a Date object.");
   });
 };


Mime
View raw message