Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Updated permalink to use download instead of dataDownload

Mike McGann80744b020266
diff --git a/test/data/wv.data-test.js b/test/data/wv.data-test.js
index 39191e808..ec20722cb 100644
--- a/test/data/wv.data-test.js
+++ b/test/data/wv.data-test.js
@@ -9,32 +9,43 @@
* All Rights Reserved.
*/
-buster.testCase("wv.data", {
+buster.testCase("wv.data", (function() {
- config: null,
- errors: null,
+ var self = {};
- setUp: function() {
- this.config = {
+ var config;
+ var errors;
+
+ self.setUp = function() {
+ config = {
products: {
"product1": {}
}
};
- this.errors = [];
- },
+ errors = [];
+ };
- "Parses state": function() {
+ self["Parses state, 1.1"] = function() {
var state = { dataDownload: "product1" };
- wv.data.parse(state, this.errors, this.config);
- buster.assert.equals(state.dataDownload, "product1");
- buster.assert.equals(this.errors.length, 0);
- },
-
- "Error on an invalid product": function() {
- var state = { dataDownload: "productX" };
- wv.data.parse(state, this.errors, this.config);
- buster.refute(state.dataDownload);
- buster.assert.equals(this.errors.length, 1);
- }
-
-});
+ wv.data.parse(state, errors, config);
+ buster.assert.equals(state.download, "product1");
+ buster.assert.equals(errors.length, 0);
+ };
+
+ self["Parses state, 1.2"] = function() {
+ var state = { download: "product1" };
+ wv.data.parse(state, errors, config);
+ buster.assert.equals(state.download, "product1");
+ buster.assert.equals(errors.length, 0);
+ };
+
+ self["Error on an invalid product"] = function() {
+ var state = { download: "productX" };
+ wv.data.parse(state, errors, config);
+ buster.refute(state.download);
+ buster.assert.equals(errors.length, 1);
+ };
+
+ return self;
+
+}()));
diff --git a/test/data/wv.data.model-test.js b/test/data/wv.data.model-test.js
index d54ee152e..f3e0a1e4a 100644
--- a/test/data/wv.data.model-test.js
+++ b/test/data/wv.data.model-test.js
@@ -46,7 +46,7 @@ buster.testCase("wv.data.model", {
this.model.selectProduct("product1");
var state = {};
this.model.save(state);
- buster.refute(state.dataDownload);
+ buster.refute(state.download);
},
"Saves state": function() {
@@ -54,7 +54,7 @@ buster.testCase("wv.data.model", {
this.model.selectedProduct = "product1";
var state = {};
this.model.save(state);
- buster.assert.equals(state.dataDownload, "product1");
+ buster.assert.equals(state.download, "product1");
},
"Subscribed for startup event when data download in load state": function() {
@@ -63,7 +63,7 @@ buster.testCase("wv.data.model", {
on: this.stub()
}
};
- var state = { dataDownload: "product1" };
+ var state = { download: "product1" };
this.model.load(state, this.errors);
buster.assert.equals(this.errors.length, 0);
buster.assert.calledWith(this.models.wv.events.on, "startup");
@@ -76,7 +76,7 @@ buster.testCase("wv.data.model", {
}
};
this.models.layers.remove("layer1");
- var state = { dataDownload: "product1" };
+ var state = { download: "product1" };
this.model.load(state, this.errors);
buster.assert.equals(this.errors.length, 1);
buster.refute.calledWith(this.models.wv.events.on, "startup");
diff --git a/web/js/data/wv.data.js b/web/js/data/wv.data.js
index 434ad497b..3e5bea560 100644
--- a/web/js/data/wv.data.js
+++ b/web/js/data/wv.data.js
@@ -14,10 +14,14 @@ var wv = wv || {};
wv.data = (function(self) {
self.parse = function(state, errors, config) {
- var productId = state.dataDownload;
+ if ( state.dataDownload ) {
+ state.download = state.dataDownload;
+ delete state.dataDownload;
+ }
+ var productId = state.download;
if ( productId ) {
if ( !config.products[productId] ) {
- delete state.dataDownload;
+ delete state.download;
errors.push({ message: "No such product: " + productId });
}
}
diff --git a/web/js/data/wv.data.model.js b/web/js/data/wv.data.model.js
index 1c241ab7d..c4fd537bd 100644
--- a/web/js/data/wv.data.model.js
+++ b/web/js/data/wv.data.model.js
@@ -283,12 +283,12 @@ wv.data.model = wv.data.model || function(models, config) {
self.save = function(state) {
if ( self.active ) {
- state.dataDownload = self.selectedProduct;
+ state.download = self.selectedProduct;
}
};
self.load = function(state, errors) {
- var productId = state.dataDownload;
+ var productId = state.download;
if ( productId ) {
var found = _.find(models.layers.active, { product: productId });
if ( !found ) {