Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Fixed bug that was causing mininfication to fail. Also fixed failed test

Mike McGann59dfa89da3c3
diff --git a/js/Worldview/Map/ProductMap.js b/js/Worldview/Map/ProductMap.js
index f642b6b9c..004e2f5a2 100644
--- a/js/Worldview/Map/ProductMap.js
+++ b/js/Worldview/Map/ProductMap.js
@@ -247,7 +247,7 @@ Worldview.Map.ProductMap = function(containerId, mapConfig, component) {
var productConfig = productConfigs[name];
if ( !productConfig ) {
log.warn("No such product: " + name);
- return true;
+ return false;
}
if ( $.inArray(name, self.products) >= 0 ) {
log.warn("Product already added: " + name);
diff --git a/js/Worldview/Permalink.js b/js/Worldview/Permalink.js
index 7a67e1be0..db1bdb2da 100644
--- a/js/Worldview/Permalink.js
+++ b/js/Worldview/Permalink.js
@@ -25,12 +25,12 @@ $(function() {
/**
* Constant: ENCODING_EXCEPTIONS
* Characters that should not be encoded with encodeURI component. An
- * array of objects where each object contains "replace" which is the
- * regular expression to match after encoding, and "with" which is the
+ * array of objects where each object contains "match" which is the
+ * regular expression to match after encoding, and "replace" which is the
* string to replace the match after encoding.
*/
ns.ENCODING_EXCEPTIONS = [
- { replace: new RegExp("%2C", "g"), with: "," }
+ { match: new RegExp("%2C", "g"), replace: "," }
];
/**
@@ -177,7 +177,7 @@ $(function() {
var encode = function(value) {
var encoded = encodeURIComponent(value);
$.each(ns.ENCODING_EXCEPTIONS, function(index, exception) {
- encoded = encoded.replace(exception.replace, exception.with);
+ encoded = encoded.replace(exception.match, exception.replace);
});
return encoded;
}
diff --git a/test/Worldview/Map/testProductMap.js b/test/Worldview/Map/testProductMap.js
index 17e349bec..abef869ea 100644
--- a/test/Worldview/Map/testProductMap.js
+++ b/test/Worldview/Map/testProductMap.js
@@ -136,15 +136,11 @@ TestCase("Map.ProductMap", TestSuite.Tests({
assertTrue($.inArray("alpha", productMap.products) >= 0);
},
- // Check that an error is thrown on an undefined product
+ // Check that nothing is added for an undefined product
testAppendNoProduct: function() {
productMap = ns.ProductMap("__TEST_PRODUCT_MAP", mapConfig);
- try {
- productMap.append("omega");
- fail("Product should not exist");
- } catch ( message ) {
- assertEquals("No such product: omega", message);
- }
+ productMap.append("omega");
+ assertEquals(-1, $.inArray("omega", productMap.products));
},
// Check that only one layer exists after a duplicate add