diff --git a/examples/html5Geolocation/js/vendor/geofire.min.js b/examples/html5Geolocation/js/vendor/geofire.min.js
old mode 100755
new mode 100644
diff --git a/src/geoCallbackRegistration.js b/src/geoCallbackRegistration.js
index 810be287..f8ec8407 100644
--- a/src/geoCallbackRegistration.js
+++ b/src/geoCallbackRegistration.js
@@ -3,7 +3,7 @@
*
* @constructor
* @this {GeoCallbackRegistration}
- * @param {function} cancelCallback Callback to run when this callback registration is cancelled.
+ * @callback cancelCallback Callback to run when this callback registration is cancelled.
*/
var GeoCallbackRegistration = function(cancelCallback) {
/********************/
diff --git a/src/geoFire.js b/src/geoFire.js
index 38edd181..66157600 100644
--- a/src/geoFire.js
+++ b/src/geoFire.js
@@ -24,8 +24,8 @@ var GeoFire = function(firebaseRef) {
* If the provided key already exists in this GeoFire, it will be overwritten with the new location value.
*
* @param {string} key The key representing the location to add.
- * @param {array} location The [latitude, longitude] pair to add.
- * @return {RSVP.Promise} A promise that is fulfilled when the write is complete.
+ * @param {Array.} location The [latitude, longitude] pair to add.
+ * @return {Promise.<>} A promise that is fulfilled when the write is complete.
*/
this.set = function(key, location) {
validateKey(key);
@@ -57,7 +57,7 @@ var GeoFire = function(firebaseRef) {
* If the provided key does not exist, the returned promise is fulfilled with null.
*
* @param {string} key The key of the location to retrieve.
- * @return {RSVP.Promise} A promise that is fulfilled with the location of the given key.
+ * @return {Promise.>} A promise that is fulfilled with the location of the given key.
*/
this.get = function(key) {
validateKey(key);
@@ -80,7 +80,7 @@ var GeoFire = function(firebaseRef) {
* If the provided key is not in this GeoFire, the promise will still successfully resolve.
*
* @param {string} key The key of the location to remove.
- * @return {RSVP.Promise} A promise that is fulfilled after the inputted key is removed.
+ * @return {Promise.} A promise that is fulfilled after the inputted key is removed.
*/
this.remove = function(key) {
return this.set(key, null);
@@ -89,7 +89,7 @@ var GeoFire = function(firebaseRef) {
/**
* Returns a new GeoQuery instance with the provided queryCriteria.
*
- * @param {object} queryCriteria The criteria which specifies the GeoQuery's center and radius.
+ * @param {Object} queryCriteria The criteria which specifies the GeoQuery's center and radius.
* @return {GeoQuery} A new GeoQuery object.
*/
this.query = function(queryCriteria) {
@@ -111,8 +111,8 @@ var GeoFire = function(firebaseRef) {
* via the Haversine formula. Note that this is approximate due to the fact that the
* Earth's radius varies between 6356.752 km and 6378.137 km.
*
- * @param {array} location1 The [latitude, longitude] pair of the first location.
- * @param {array} location2 The [latitude, longitude] pair of the second location.
+ * @param {Array.} location1 The [latitude, longitude] pair of the first location.
+ * @param {Array.} location2 The [latitude, longitude] pair of the second location.
* @return {number} The distance, in kilometers, between the inputted locations.
*/
GeoFire.distance = function(location1, location2) {
diff --git a/src/geoFireUtils.js b/src/geoFireUtils.js
index d5d2bb40..4d4bbadc 100644
--- a/src/geoFireUtils.js
+++ b/src/geoFireUtils.js
@@ -65,7 +65,7 @@ var validateKey = function(key) {
/**
* Validates the inputted location and throws an error if it is invalid.
*
- * @param {array} location The [latitude, longitude] pair to be verified.
+ * @param {Array.} location The [latitude, longitude] pair to be verified.
*/
var validateLocation = function(location) {
var error;
@@ -129,7 +129,7 @@ var validateGeohash = function(geohash) {
/**
* Validates the inputted query criteria and throws an error if it is invalid.
*
- * @param {object} newQueryCriteria The criteria which specifies the query's center and/or radius.
+ * @param {Object} newQueryCriteria The criteria which specifies the query's center and/or radius.
*/
var validateCriteria = function(newQueryCriteria, requireCenterAndRadius) {
if (typeof newQueryCriteria !== "object") {
@@ -182,13 +182,12 @@ var degreesToRadians = function(degrees) {
};
/**
- * Generates a geohash of the specified precision/string length
- * from the [latitude, longitude] pair, specified as an array.
+ * Generates a geohash of the specified precision/string length from the [latitude, longitude]
+ * pair, specified as an array.
*
- * @param {array} location The [latitude, longitude] pair to encode into
- * a geohash.
- * @param {number} precision The length of the geohash to create. If no
- * precision is specified, the global default is used.
+ * @param {Array.} location The [latitude, longitude] pair to encode into a geohash.
+ * @param {number=} precision The length of the geohash to create. If no precision is
+ * specified, the global default is used.
* @return {string} The geohash of the inputted location.
*/
var encodeGeohash = function(location, precision) {
@@ -255,10 +254,11 @@ var encodeGeohash = function(location, precision) {
};
/**
- * Calculates the number of degrees a given distance is at a given latitude
- * @param {number} distance
- * @param {number} latitude
- * @return {number} The number of degrees the distance corresponds to
+ * Calculates the number of degrees a given distance is at a given latitude.
+ *
+ * @param {number} distance The distance to convert.
+ * @param {number} latitude The latitude at which to calculate.
+ * @return {number} The number of degrees the distance corresponds to.
*/
var metersToLongitudeDegrees = function(distance, latitude) {
var radians = degreesToRadians(latitude);
@@ -274,11 +274,12 @@ var metersToLongitudeDegrees = function(distance, latitude) {
};
/**
- * Calculates the bits necessary to reach a given resolution in meters for
- * the longitude at a given latitude
- * @param {number} resolution
- * @param {number} latitude
- * @return {number}
+ * Calculates the bits necessary to reach a given resolution, in meters, for the longitude at a
+ * given latitude.
+ *
+ * @param {number} resolution The desired resolution.
+ * @param {number} latitude The latitude used in the conversion.
+ * @return {number} The bits necessary to reach a given resolution, in meters.
*/
var longitudeBitsForResolution = function(resolution, latitude) {
var degs = metersToLongitudeDegrees(resolution, latitude);
@@ -286,18 +287,19 @@ var longitudeBitsForResolution = function(resolution, latitude) {
};
/**
- * Calculates the bits necessary to reach a given resolution in meters for
- * the latitude
- * @param {number} resolution
+ * Calculates the bits necessary to reach a given resolution, in meters, for the latitude.
+ *
+ * @param {number} resolution The bits necessary to reach a given resolution, in meters.
*/
var latitudeBitsForResolution = function(resolution) {
return Math.min(Math.log2(g_EARTH_MERI_CIRCUMFERENCE/2/resolution), g_MAXIMUM_BITS_PRECISION);
};
/**
- * Wraps the longitude to [-180,180]
- * @param {number} longitude
- * @return {number} longitude
+ * Wraps the longitude to [-180,180].
+ *
+ * @param {number} longitude The longitude to wrap.
+ * @return {number} longitude The resulting longitude.
*/
var wrapLongitude = function(longitude) {
if (longitude <= 180 && longitude >= -180) {
@@ -313,12 +315,12 @@ var wrapLongitude = function(longitude) {
};
/**
- * Calculates the maximum number of bits of a geohash to get
- * a bounding box that is larger than a given size at the given
- * coordinate.
- * @param {array} coordinate The coordinate as a [latitude, longitude] pair
- * @param {number} size The size of the bounding box
- * @return {number} The number of bits necessary for the geohash
+ * Calculates the maximum number of bits of a geohash to get a bounding box that is larger than a
+ * given size at the given coordinate.
+ *
+ * @param {Array.} coordinate The coordinate as a [latitude, longitude] pair.
+ * @param {number} size The size of the bounding box.
+ * @return {number} The number of bits necessary for the geohash.
*/
var boundingBoxBits = function(coordinate, size) {
var latDeltaDegrees = size/g_METERS_PER_DEGREE_LATITUDE;
@@ -331,13 +333,13 @@ var boundingBoxBits = function(coordinate, size) {
};
/**
- * Calculates 8 points on the bounding box and the center of a given circle.
- * At least one geohash of these 9 coordinates, truncated to a precision of
- * at most radius, are guaranteed to be prefixes of any geohash that lies
- * within the circle.
- * @param {array} center The center given as [latitude, longitude]
- * @param {number} radius The radius of the circle
- * @return {number} The four bounding box points
+ * Calculates eight points on the bounding box and the center of a given circle. At least one
+ * geohash of these nine coordinates, truncated to a precision of at most radius, are guaranteed
+ * to be prefixes of any geohash that lies within the circle.
+ *
+ * @param {Array.} center The center given as [latitude, longitude].
+ * @param {number} radius The radius of the circle.
+ * @return {Array.>} The eight bounding box points.
*/
var boundingBoxCoordinates = function(center, radius) {
var latDegrees = radius/g_METERS_PER_DEGREE_LATITUDE;
@@ -360,10 +362,11 @@ var boundingBoxCoordinates = function(center, radius) {
};
/**
- * Calculates the bounding box query for a geohash with x bits precision
- * @param {string} geohash
- * @param {number} bits
- * @return {array} A [start,end] pair
+ * Calculates the bounding box query for a geohash with x bits precision.
+ *
+ * @param {string} geohash The geohash whose bounding box query to generate.
+ * @param {number} bits The number of bits of precision.
+ * @return {Array.} A [start, end] pair of geohashes.
*/
var geohashQuery = function(geohash, bits) {
validateGeohash(geohash);
@@ -393,12 +396,12 @@ var geohashQuery = function(geohash, bits) {
};
/**
- * Calculates a set of queries to fully contain a given circle
- * A query is a [start,end] pair where any geohash is guaranteed to
- * be lexiographically larger then start and smaller than end
- * @param {array} center The center given as [latitude, longitude] pair
- * @param {number} radius The radius of the circle
- * @return {array} An array of geohashes containing a [start,end] pair
+ * Calculates a set of queries to fully contain a given circle. A query is a [start, end] pair
+ * where any geohash is guaranteed to be lexiographically larger then start and smaller than end.
+ *
+ * @param {Array.} center The center given as [latitude, longitude] pair.
+ * @param {number} radius The radius of the circle.
+ * @return {Array.>} An array of geohashes containing a [start, end] pair.
*/
var geohashQueries = function(center, radius) {
validateLocation(center);
@@ -417,11 +420,11 @@ var geohashQueries = function(center, radius) {
};
/**
- * Encodes a location and geohash as a GeoFire object
+ * Encodes a location and geohash as a GeoFire object.
*
- * @param {array} location The location as [latitude, longitude] pair.
- * @param {string} geohash The geohash of the location
- * @return {Object} The location encoded as GeoFire object
+ * @param {Array.} location The location as [latitude, longitude] pair.
+ * @param {string} geohash The geohash of the location.
+ * @return {Object} The location encoded as GeoFire object.
*/
function encodeGeoFireObject(location, geohash) {
validateLocation(location);
@@ -433,10 +436,11 @@ function encodeGeoFireObject(location, geohash) {
}
/**
- * Decodes the location given as GeoFire object. Returns null if decoding fails
+ * Decodes the location given as GeoFire object. Returns null if decoding fails.
*
- * @param {Object} geoFireObj The location encoded as GeoFire object
- * @return {array} location The location as [latitude, longitude] pair or null if decoding fails
+ * @param {Object} geoFireObj The location encoded as GeoFire object.
+ * @return {?Array.} location The location as [latitude, longitude] pair or null if
+ * decoding fails.
*/
function decodeGeoFireObject(geoFireObj) {
if (geoFireObj !== null && geoFireObj.hasOwnProperty("l") && Array.isArray(geoFireObj.l) && geoFireObj.l.length === 2) {
diff --git a/src/geoQuery.js b/src/geoQuery.js
index 49a4495d..67ed3b1d 100644
--- a/src/geoQuery.js
+++ b/src/geoQuery.js
@@ -4,7 +4,7 @@
* @constructor
* @this {GeoQuery}
* @param {Firebase} firebaseRef A Firebase reference.
- * @param {object} queryCriteria The criteria which specifies the query's center and radius.
+ * @param {Object} queryCriteria The criteria which specifies the query's center and radius.
*/
var GeoQuery = function (firebaseRef, queryCriteria) {
/*********************/
@@ -15,8 +15,8 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
*
* @param {string} eventType The event type whose callbacks to fire. One of "key_entered", "key_exited", or "key_moved".
* @param {string} key The key of the location for which to fire the callbacks.
- * @param {array|null} location The location as latitude longitude pair
- * @param {double|null} distanceFromCenter The distance from the center or null
+ * @param {?Array.} location The location as [latitude, longitude] pair
+ * @param {?double} distanceFromCenter The distance from the center or null.
*/
function _fireCallbacksForKey(eventType, key, location, distanceFromCenter) {
_callbacks[eventType].forEach(function(callback) {
@@ -40,8 +40,9 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
/**
* Decodes a query string to a query
- * @param {string} str The encoded query
- * @return {array} The decoded query as a [start,end] pair
+ *
+ * @param {string} str The encoded query.
+ * @return {Array.} The decoded query as a [start, end] pair.
*/
function _stringToQuery(string) {
var decoded = string.split(":");
@@ -52,9 +53,10 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
}
/**
- * Encodes a query as a string for easier indexing and equality
- * @param {array} query The query to encode
- * @param {string} The encoded query as string
+ * Encodes a query as a string for easier indexing and equality.
+ *
+ * @param {Array.} query The query to encode.
+ * @param {string} The encoded query as string.
*/
function _queryToString(query) {
if (query.length !== 2) {
@@ -64,9 +66,10 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
}
/**
- * Turns off all callbacks for geo query
- * @param {array} query The geohash query
- * @param {object} queryState An object storing the current state of the query
+ * Turns off all callbacks for the provide geohash query.
+ *
+ * @param {Array.} query The geohash query.
+ * @param {Object} queryState An object storing the current state of the query.
*/
function _cancelGeohashQuery(query, queryState) {
var queryRef = _firebaseRef.startAt(query[0]).endAt(query[1]);
@@ -116,13 +119,13 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
/**
* Callback for any updates to locations. Will update the information about a key and fire any necessary
- * events every time the key's location changes
+ * events every time the key's location changes.
*
* When a key is removed from GeoFire or the query, this function will be called with null and performs
* any necessary cleanup.
*
- * @param {string} key The key of the geofire location
- * @param {array|null} location The location as [latitude, longitude] pair
+ * @param {string} key The key of the geofire location.
+ * @param {?Array.} location The location as [latitude, longitude] pair.
*/
function _updateLocation(key, location) {
validateLocation(location);
@@ -154,10 +157,10 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
}
/**
- * Checks if this geohash is currently part of any of the geohash queries
+ * Checks if this geohash is currently part of any of the geohash queries.
*
- * @param {string} geohash The geohash
- * @param {boolean} Returns true if the geohash is part of any of the current geohash queries
+ * @param {string} geohash The geohash.
+ * @param {boolean} Returns true if the geohash is part of any of the current geohash queries.
*/
function _geohashInSomeQuery(geohash) {
for (var queryStr in _currentGeohashesQueried) {
@@ -172,10 +175,11 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
}
/**
- * Removes the location from the local state and fires any events if necessary
+ * Removes the location from the local state and fires any events if necessary.
*
- * @param {string} key The key to be removed
- * @param {array} currentLocation The current location as [latitude, longitude] pair or null if removed
+ * @param {string} key The key to be removed.
+ * @param {?Array.} currentLocation The current location as [latitude, longitude] pair
+ * or null if removed.
*/
function _removeLocation(key, currentLocation) {
var locationDict = _locationsTracked[key];
@@ -328,7 +332,7 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
/**
* Returns the location signifying the center of this query.
*
- * @return {array} The [latitude, longitude] pair signifying the center of this query.
+ * @return {Array.} The [latitude, longitude] pair signifying the center of this query.
*/
this.center = function() {
return _center;
@@ -337,7 +341,7 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
/**
* Returns the radius of this query, in kilometers.
*
- * @return {integer} The radius of this query, in kilometers.
+ * @return {number} The radius of this query, in kilometers.
*/
this.radius = function() {
return _radius;
@@ -346,7 +350,7 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
/**
* Updates the criteria for this query.
*
- * @param {object} newQueryCriteria The criteria which specifies the query's center and radius.
+ * @param {Object} newQueryCriteria The criteria which specifies the query's center and radius.
*/
this.updateCriteria = function(newQueryCriteria) {
// Validate and save the new query criteria
@@ -415,7 +419,7 @@ var GeoQuery = function (firebaseRef, queryCriteria) {
*
* @param {string} eventType The event type for which to attach the callback. One of "ready", "key_entered",
* "key_exited", or "key_moved".
- * @param {function} callback Callback function to be called when an event of type eventType fires.
+ * @callback callback Callback function to be called when an event of type eventType fires.
* @return {GeoCallbackRegistration} A callback registration which can be used to cancel the provided callback.
*/
this.on = function(eventType, callback) {
diff --git a/tests/specs/common.spec.js b/tests/specs/common.spec.js
index 34c22f3b..11563549 100644
--- a/tests/specs/common.spec.js
+++ b/tests/specs/common.spec.js
@@ -126,3 +126,12 @@ function Checklist(items, expect, done) {
return (this.length() === 0);
};
};
+
+/* Common error handler for use in .catch() statements of promises. This will
+ * cause the test to fail, outputting the details of the exception. Otherwise, tests
+ * tend to fail due to the Jasmine ASYNC timeout and provide no details of what actually
+ * went wrong.
+ **/
+function failTestOnCaughtError(error) {
+ expect(error).toBeNull();
+}
diff --git a/tests/specs/geoCallbackRegistration.spec.js b/tests/specs/geoCallbackRegistration.spec.js
index 030c7f5c..8744579b 100644
--- a/tests/specs/geoCallbackRegistration.spec.js
+++ b/tests/specs/geoCallbackRegistration.spec.js
@@ -51,7 +51,7 @@ describe("GeoCallbackRegistration Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);;
});
it("\"key_entered\" registrations can be cancelled", function(done) {
@@ -82,7 +82,7 @@ describe("GeoCallbackRegistration Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p4");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_exited\" registrations can be cancelled", function(done) {
@@ -117,7 +117,7 @@ describe("GeoCallbackRegistration Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
it("Cancelling a \"key_moved\" registration does not cancel all \"key_moved\" callbacks", function(done) {
@@ -155,7 +155,7 @@ describe("GeoCallbackRegistration Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
it("Cancelling a \"key_entered\" registration does not cancel all \"key_entered\" callbacks", function(done) {
@@ -189,7 +189,7 @@ describe("GeoCallbackRegistration Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p4");
- });
+ }).catch(failTestOnCaughtError);
});
it("Cancelling a \"key_exited\" registration does not cancel all \"key_exited\" callbacks", function(done) {
@@ -227,7 +227,7 @@ describe("GeoCallbackRegistration Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
it("Calling cancel on a GeoCallbackRegistration twice does not throw", function() {
diff --git a/tests/specs/geoFire.spec.js b/tests/specs/geoFire.spec.js
index eeedd93d..4c7e17ff 100755
--- a/tests/specs/geoFire.spec.js
+++ b/tests/specs/geoFire.spec.js
@@ -55,7 +55,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("set() handles decimal latitudes and longitudes", function(done) {
@@ -77,7 +77,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("set() updates Firebase when changing a pre-existing key", function(done) {
@@ -103,7 +103,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("set() updates Firebase when changing a pre-existing key to the same location", function(done) {
@@ -129,7 +129,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("set() handles multiple keys at the same location", function(done) {
@@ -151,7 +151,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("set() updates Firebase after complex operations", function(done) {
@@ -198,7 +198,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p6");
- });
+ }).catch(failTestOnCaughtError);
});
it("set() does not throw errors given valid keys", function() {
@@ -272,7 +272,7 @@ describe("GeoFire Tests:", function() {
}).then(function(location) {
expect(location).toEqual([-90, -90]);
cl.x("p4");
- });
+ }).catch(failTestOnCaughtError);
});
it("get() does not throw errors given valid keys", function() {
@@ -321,7 +321,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
it("set() does nothing given a non-existent location and null", function(done) {
@@ -353,7 +353,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
it("remove() removes existing location", function(done) {
@@ -388,7 +388,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
it("remove() does nothing given a non-existent location", function(done) {
@@ -420,7 +420,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
it("remove() only removes one key if multiple keys are at the same location", function(done) {
@@ -445,7 +445,7 @@ describe("GeoFire Tests:", function() {
});
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("remove() does not throw errors given valid keys", function() {
diff --git a/tests/specs/geoFireUtils.spec.js b/tests/specs/geoFireUtils.spec.js
index 40b528d1..ce10ba54 100644
--- a/tests/specs/geoFireUtils.spec.js
+++ b/tests/specs/geoFireUtils.spec.js
@@ -8,13 +8,6 @@ describe("geoFireUtils Tests:", function() {
it("validateKey() throws errors given invalid keys", function() {
invalidKeys.forEach(function(invalidKey) {
- try {
- validateKey(invalidKey);
- console.log(invalidKey);
- }
- catch (e){
-
- }
expect(function() { validateKey(invalidKey); }).toThrow();
});
});
diff --git a/tests/specs/geoQuery.spec.js b/tests/specs/geoQuery.spec.js
index bbeb6d55..d91ea8c8 100644
--- a/tests/specs/geoQuery.spec.js
+++ b/tests/specs/geoQuery.spec.js
@@ -98,7 +98,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("updateCriteria() fires \"key_entered\" callback for locations with complex keys which now belong to the GeoQuery", function(done) {
@@ -123,7 +123,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("updateCriteria() fires \"key_exited\" callback for locations which no longer belong to the GeoQuery", function(done) {
@@ -148,7 +148,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("updateCriteria() does not cause event callbacks to fire on the previous criteria", function(done) {
@@ -187,7 +187,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p4");
- });
+ }).catch(failTestOnCaughtError);
});
it("updateCriteria() does not cause \"key_moved\" callbacks to fire for keys in both the previous and updated queries", function(done) {
@@ -229,7 +229,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p4");
- });
+ }).catch(failTestOnCaughtError);
});
it("updateCriteria() does not cause \"key_exited\" callbacks to fire twice for keys in the previous query but not in the updated query and which were moved after the query was updated", function(done) {
@@ -283,7 +283,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p6");
- });
+ }).catch(failTestOnCaughtError);
});
it("updateCriteria() does not throw errors given valid query criteria", function() {
@@ -466,7 +466,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback does not fire for locations outside of the GeoQuery which are moved somewhere else outside of the GeoQuery", function(done) {
@@ -495,7 +495,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback does not fire for locations outside of the GeoQuery which are moved within the GeoQuery", function(done) {
@@ -524,7 +524,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback does not fire for locations within the GeoQuery which are moved somewhere outside of the GeoQuery", function(done) {
@@ -553,7 +553,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback does not fires for a location within the GeoQuery which is set to the same location", function(done) {
@@ -583,7 +583,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback fires for locations within the GeoQuery which are moved somewhere else within the GeoQuery", function(done) {
@@ -612,7 +612,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback gets passed correct location parameter", function(done) {
@@ -641,7 +641,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback gets passed correct distance parameter", function(done) {
@@ -670,7 +670,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback properly fires when multiple keys are at the same location within the GeoQuery and only one of them moves somewhere else within the GeoQuery", function(done) {
@@ -699,7 +699,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_moved\" callback properly fires when a location within the GeoQuery moves somehwere else within the GeoQuery that is already occupied by another key", function(done) {
@@ -728,7 +728,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("multiple \"key_moved\" callbacks fire for locations within the GeoQuery which are moved somewhere else within the GeoQuery", function(done) {
@@ -760,7 +760,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
});
@@ -786,7 +786,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_entered\" callback fires when a location enters the GeoQuery after onKeyEntered() was called", function(done) {
@@ -810,7 +810,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_entered\" callback gets passed correct location parameter", function(done) {
@@ -834,7 +834,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_entered\" callback gets passed correct distance parameter", function(done) {
@@ -858,7 +858,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_entered\" callback properly fires when multiple keys are at the same location outside the GeoQuery and only one of them moves within the GeoQuery", function(done) {
@@ -884,7 +884,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_entered\" callback properly fires when a location outside the GeoQuery moves somewhere within the GeoQuery that is already occupied by another key", function(done) {
@@ -910,7 +910,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("multiple \"key_entered\" callbacks fire when a location enters the GeoQuery", function(done) {
@@ -937,7 +937,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p2");
- });
+ }).catch(failTestOnCaughtError);
});
});
@@ -970,7 +970,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_exited\" callback gets passed correct location parameter", function(done) {
@@ -1002,7 +1002,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_exited\" callback gets passed correct distance parameter", function(done) {
@@ -1034,7 +1034,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_exited\" callback gets passed null for location and distance parameters if the key is entirely removed from GeoFire", function(done) {
@@ -1058,7 +1058,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_exited\" callback fires when a location within the GeoQuery is entirely removed from GeoFire", function(done) {
@@ -1083,7 +1083,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_exited\" callback properly fires when multiple keys are at the same location inside the GeoQuery and only one of them moves outside the GeoQuery", function(done) {
@@ -1108,7 +1108,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("\"key_exited\" callback properly fires when a location inside the GeoQuery moves somewhere outside the GeoQuery that is already occupied by another key", function(done) {
@@ -1134,7 +1134,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
it("multiple \"key_exited\" callbacks fire when a location leaves the GeoQuery", function(done) {
@@ -1168,7 +1168,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p3");
- });
+ }).catch(failTestOnCaughtError);
});
});
@@ -1215,7 +1215,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p4");
- });
+ }).catch(failTestOnCaughtError);
});
it ("location moving between geohash queries triggers a key_moved", function(done) {
@@ -1247,7 +1247,7 @@ describe("GeoQuery Tests:", function() {
cl.x("p2");
return wait(100);
- });
+ }).catch(failTestOnCaughtError);
});
});
@@ -1312,7 +1312,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
it("Calling cancel() on one GeoQuery does not cancel other GeoQueries", function(done) {
@@ -1374,7 +1374,7 @@ describe("GeoQuery Tests:", function() {
return wait(100);
}).then(function() {
cl.x("p5");
- });
+ }).catch(failTestOnCaughtError);
});
});
});