Updated Branches: refs/heads/master 6c6d90bd8 -> b33e3c68c
Seperating out watch variables for the two watchPosition geo tests, just in case of collision 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/b33e3c68 Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/tree/b33e3c68 Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/diff/b33e3c68 Branch: refs/heads/master Commit: b33e3c68ca3c9bb5d4ed3176d609f865228e6409 Parents: 6c6d90b Author: Fil Maj <maj....@gmail.com> Authored: Wed May 30 12:25:46 2012 -0700 Committer: Fil Maj <maj....@gmail.com> Committed: Wed May 30 12:25:46 2012 -0700 ---------------------------------------------------------------------- autotest/tests/geolocation.tests.js | 20 ++++++++++++-------- 1 files changed, 12 insertions(+), 8 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-cordova-mobile-spec/blob/b33e3c68/autotest/tests/geolocation.tests.js ---------------------------------------------------------------------- diff --git a/autotest/tests/geolocation.tests.js b/autotest/tests/geolocation.tests.js index 6cb7650..3b5d419 100644 --- a/autotest/tests/geolocation.tests.js +++ b/autotest/tests/geolocation.tests.js @@ -64,19 +64,18 @@ describe('Geolocation (navigator.geolocation)', function () { }); describe('watchPosition method', function() { - var watch = null; - - afterEach(function() { - navigator.geolocation.clearWatch(watch); - }); - describe('error callback', function() { + var errorWatch = null; + + afterEach(function() { + navigator.geolocation.clearWatch(errorWatch); + }); it("should be called if we set timeout to 0 and maximumAge to a very small number", function() { var win = jasmine.createSpy(), fail = jasmine.createSpy(); runs(function () { - watch = navigator.geolocation.watchPosition(win, fail, { + errorWatch = navigator.geolocation.watchPosition(win, fail, { maximumAge: 0, timeout: 0 }); @@ -91,6 +90,11 @@ describe('Geolocation (navigator.geolocation)', function () { }); describe('success callback', function() { + var successWatch = null; + + afterEach(function() { + navigator.geolocation.clearWatch(successWatch); + }); it("should be called with a Position object", function() { var win = jasmine.createSpy().andCallFake(function(p) { expect(p.coords).toBeDefined(); @@ -100,7 +104,7 @@ describe('Geolocation (navigator.geolocation)', function () { fail = jasmine.createSpy(); runs(function () { - watch = navigator.geolocation.watchPosition(win, fail, { + successWatch = navigator.geolocation.watchPosition(win, fail, { maximumAge:300000 // 5 minutes maximum age of cached position }); });