From b0490ecdb6ee61ad5b4a5b436e78d4a64747251a Mon Sep 17 00:00:00 2001 From: Mike Adair Date: Tue, 19 Jun 2012 10:17:41 -0400 Subject: [PATCH] initial set of tests running --- src/api/map.js | 4 ++-- src/ol/Map.js | 11 +++++++---- test/spec/ol/Map.test.js | 5 ++++- 3 files changed, 13 insertions(+), 7 deletions(-) diff --git a/src/api/map.js b/src/api/map.js index db0863e0a6..e815b01556 100644 --- a/src/api/map.js +++ b/src/api/map.js @@ -59,8 +59,8 @@ ol.map = function(opt_arg){ if (goog.isDef(projection)) { map.setProjection(projection); } - if (goog.isDef(projection)) { - map.setUserProjection(projection); + if (goog.isDef(userProjection)) { + map.setUserProjection(userProjection); } return map; diff --git a/src/ol/Map.js b/src/ol/Map.js index 14765241f4..07a8794f99 100644 --- a/src/ol/Map.js +++ b/src/ol/Map.js @@ -14,13 +14,13 @@ ol.Map = function() { * @private * @type {ol.Projection} */ - this.projection_ = new ol.Projection('EPSG:900913'); + this.projection_ = null; /** * @private * @type {ol.Projection} */ - this.userProjection_ = new ol.Projection('EPSG:4326'); + this.userProjection_ = null; /** * @private @@ -66,7 +66,7 @@ ol.Map.prototype.getCenter = function() { * @return {ol.Projection} Projection. */ ol.Map.prototype.getProjection = function() { - if (!goog.isDef(this.projection_)) { + if (goog.isNull(this.projection_)) { this.projection_ = new ol.Projection(this.DEFAULT_PROJECTION); } return this.projection_; @@ -77,7 +77,7 @@ ol.Map.prototype.getProjection = function() { * @return {ol.Projection} User projection. */ ol.Map.prototype.getUserProjection = function() { - if (!goog.isDef(this.userProjection_)) { + if (goog.isNull(this.userProjection_)) { this.userProjection_ = new ol.Projection(this.DEFAULT_USER_PROJECTION); } return this.userProjection_; @@ -153,4 +153,7 @@ ol.Map.prototype.setNumZoomLevels = function(nZoom) { */ ol.Map.prototype.destroy = function() { //remove layers, etc. + for (key in this) { + delete this[key]; + } }; diff --git a/test/spec/ol/Map.test.js b/test/spec/ol/Map.test.js index ac22a5c2af..9e4905e61f 100644 --- a/test/spec/ol/Map.test.js +++ b/test/spec/ol/Map.test.js @@ -83,7 +83,10 @@ describe("ol.Map", function() { var proj; // at construction - var map = ol.map({projection: "EPSG:4326"}); + debugger; + var map = ol.map({ + projection: ol.projection("EPSG:4326") + }); proj = map.projection(); expect(proj instanceof ol.Projection).toBe(true);