Skip to content

Interactive interface for browsing global, full-resolution satellite imagery

Documentation and tests

Mike McGannf01d4872d4ec
diff --git a/doc/NaturalDocs/Menu.txt b/doc/NaturalDocs/Menu.txt
index db86be7db..361555d3c 100644
--- a/doc/NaturalDocs/Menu.txt
+++ b/doc/NaturalDocs/Menu.txt
@@ -56,6 +56,7 @@ Group: Development Notes {
Group: Code Reference {
+ File: Date (/Users/jmcgann/Code/Aptana/worldview/js/Date.js)
File: Logging (/Users/jmcgann/Code/Aptana/worldview/js/Logging.js)
File: SOTE.util (/Users/jmcgann/Code/Aptana/worldview/js/util.js)
File: TestSuite (/Users/jmcgann/Code/Aptana/worldview/test/lib/TestSuite.js)
diff --git a/js/Date.js b/js/Date.js
index dfc0ff288..2efedbe84 100644
--- a/js/Date.js
+++ b/js/Date.js
@@ -1,4 +1,18 @@
+/*
+ * NASA Worldview
+ *
+ * This code was originally developed at NASA/Goddard Space Flight Center for
+ * the Earth Science Data and Information System (ESDIS) project.
+ *
+ * Copyright (C) 2013 United States Government as represented by the
+ * Administrator of the National Aeronautics and Space Administration.
+ * All Rights Reserved.
+ */
+/**
+ * Namespace: Date
+ * Date handling utilities.
+ */
(function() {
var zeroPad = function(num, places) {
@@ -6,6 +20,21 @@
return Array(+(zero > 0 && zero)).join("0") + num;
};
+ /**
+ * Function: parseISOString
+ * Parses a UTC ISO 8601 date.
+ *
+ * Parameters:
+ * dateAsString - The string must be in the form of yyyy-MM-ddThh:mm:ssZ.
+ * Only the year, month, and day are required and the remaining string can
+ * be shortened. The Z to denote UTC is optional.
+ *
+ * Returns:
+ * A Date object.
+ *
+ * Throws:
+ * An exception if the string is invalid.
+ */
Date.parseISOString = function(dateAsString) {
var dateTimeArr = dateAsString.split(/T/);
@@ -34,7 +63,25 @@
return date;
};
-
+ /**
+ * Class: Date
+ */
+
+ /**
+ * Function: compareTo
+ * Compares this instance to a Date object and return an number indication
+ * of their relative values.
+ *
+ * This method copied from datejs:
+ * http://code.google.com/p/datejs/
+ *
+ * Parameters:
+ * date - Date object to compare [Required]
+ *
+ * Returns:
+ * 1 = this is greaterthan date. -1 = this is lessthan date.
+ * 0 = values are equal
+ */
Date.prototype.compareTo = function(date) {
if (isNaN(this)) {
throw new Error(this);
@@ -46,6 +93,13 @@
}
};
+ /**
+ * Function: clearUTCTime
+ * Sets UTC hours, minutes, seconds, and milliseconds to zero.
+ *
+ * Returns:
+ * The date object.
+ */
Date.prototype.clearUTCTime = function() {
this.setUTCHours(0);
this.setUTCMinutes(0);
@@ -54,10 +108,46 @@
return this;
};
+ /**
+ * Function: clone
+ * Creates a copy of this date object.
+ *
+ * Returns:
+ * New instance of the object.
+ */
Date.prototype.clone = function() {
return new Date(this.getTime());
};
+ /**
+ * Function: toISOString
+ * Converts to an ISO 8601 formatted string in UTC.
+ *
+ * This function provided by OpenLayers.
+ *
+ * Example;
+ * (begin code)
+ * > new Date().toISOString()
+ * "2013-03-29T14:33:38.692Z"
+ * (end code)
+ *
+ * Returns:
+ * String in the form of yyyy-MM-ddThh:mm:ss.sssZ.
+ */
+
+ /**
+ * Function: toISOStringDate
+ * Converts to an ISO 8601 formatted string in UTC without the time values.
+ *
+ * Example:
+ * (begin code)
+ * > new Date().toISOStringDate()
+ * "2013-03-29"
+ * (end code)
+ *
+ * Returns:
+ * String in the form of yyyy-MM-dd.
+ */
Date.prototype.toISOStringDate = function() {
return this.toISOString().split("T")[0];
};
diff --git a/js/dateSpan.js b/js/dateSpan.js
index 9584d24cd..911f6326c 100644
--- a/js/dateSpan.js
+++ b/js/dateSpan.js
@@ -282,7 +282,6 @@ SOTE.widget.DateSpan.prototype.fire = function(){
SOTE.widget.DateSpan.handleSlide = function(e,ui){
- console.log("handleSlide");
var value = e.target.value;
var type = e.data.type;
var self = e.data.self;
@@ -373,7 +372,6 @@ SOTE.widget.DateSpan.toggle = function(e,ui){
};
SOTE.widget.DateSpan.snap = function(e,ui){
- console.log("snap");
var self = e.data.self;
var type = e.data.type;
var numitems = self.sliders[type].length;
diff --git a/test/Worldview/Map/testProductMap.js b/test/Worldview/Map/testProductMap.js
index abef869ea..dde17559e 100644
--- a/test/Worldview/Map/testProductMap.js
+++ b/test/Worldview/Map/testProductMap.js
@@ -82,8 +82,9 @@ TestCase("Map.ProductMap", TestSuite.Tests({
try {
ns.ProductMap("__NO_MAP", mapConfig);
fail("__NO_MAP should not be a valid container");
- } catch ( message ) {
- assertEquals("No container for ProductMap: __NO_MAP", message);
+ } catch ( error ) {
+ assertEquals("No container for ProductMap: __NO_MAP",
+ error.message);
}
},
@@ -116,8 +117,8 @@ TestCase("Map.ProductMap", TestSuite.Tests({
try {
productMap = ns.ProductMap("__TEST_PRODUCT_MAP", mapConfig);
fail("foo should not be a valid projection");
- } catch ( message ) {
- assertEquals("Unsupported projection: foo", message);
+ } catch ( error ) {
+ assertEquals("Unsupported projection: foo", error.message);
}
},
diff --git a/test/jsTestDriver.conf b/test/jsTestDriver.conf
index 7167ec506..ca59dba34 100644
--- a/test/jsTestDriver.conf
+++ b/test/jsTestDriver.conf
@@ -1,21 +1,33 @@
server: http://localhost:8811
load:
- - ../js/ext/jquery/jquery-1.6.4.js
+ - ../js/ext/jquery-1.6.4/jquery.js
- ext/jshamcrest.js
- ext/jsmockito-1.0.4.git.js
- lib/*.js
- lib/TestSuite/*.js
- - ../js/ext/yui/yahoo-min.js
- - ../js/ext/yui/event-min.js
- ../js/ext/jqueryui-1.8.16/jquery-ui.min.js
- - ../js/ext/yui/combo-event-dragdrop-container-min.js
+ - ../js/ext/jquery.mobile-1.0rc2/jquery.mobile.js
+ - ../js/ext/yui-2.9.0/yahoo/yahoo.js
+ - ../js/ext/yui-2.9.0/event/event.js
+ - ../js/ext/yui-2.9.0/dom/dom.js
+ - ../js/ext/yui-2.9.0/dragdrop/dragdrop.js
+ - ../js/ext/yui-2.9.0/yahoo-dom-event/yahoo-dom-event.js
+ - ../js/ext/yui-2.9.0/animation/animation.js
+ - ../js/ext/yui-2.9.0/connection/connection.js
+ - ../js/ext/yui-2.9.0/element/element.js
+ - ../js/ext/yui-2.9.0/button/button.js
+ - ../js/ext/yui-2.9.0/container/container.js
+ - ../js/ext/yui-2.9.0/storage/storage.js
+ - ../js/ext/joyride-2.0.3/jquery.cookie.js
+ - ../js/ext/joyride-2.0.3/jquery.joyride-2.0.3.js
+ - ../js/ext/joyride-2.0.3/modernizr.mq.js
- ../js/ext/openlayers-2.12/OpenLayers.debug.js
- - ../js/ext/datejs/date.js
- - ../js/ext/jcrop/jcrop.js
- - ../js/ext/jquery.dd/jquery.dd.js
+ - ../js/ext/jcrop-0.9.10-p1/jcrop.js
+ - ../js/ext/jquery.dd-3.3/jquery.dd.js
- ../js/sote.js
- ../js/Logging.js
+ - ../js/Date.js
- ../js/Worldview.js
- ../js/Worldview/Permalink.js
- ../js/Worldview/Scheduler.js
@@ -42,6 +54,7 @@ exclude:
test:
- testLogging.js
- testWorldview.js
+ - testDate.js
- Worldview/*.js
- Worldview/Palette/*.js
- Worldview/TestSuite/*.js
diff --git a/test/testWorldview.js b/test/testWorldview.js
index 34752d280..e4455bd51 100644
--- a/test/testWorldview.js
+++ b/test/testWorldview.js
@@ -9,15 +9,6 @@
* All Rights Reserved.
*/
-TestCase("Worldview.general", TestSuite.Tests({
-
- testToISODateString: function() {
- assertEquals("2013-03-15",
- Worldview.toISODateString(new Date(2013, 02, 15)));
- }
-
-}));
-
TestCase("Worldview.namespace", TestSuite.Tests({
tearDown: function() {
@@ -159,9 +150,9 @@ TestCase("Worldview.getObjectByPath", TestSuite.Tests({
try {
ns.getObjectByPath("__TEST_GET_OBJECT_BY_PATH.XXX.bar");
fail("Should not have been a valid path");
- } catch ( message ) {
+ } catch ( error ) {
assertEquals("In __TEST_GET_OBJECT_BY_PATH.XXX.bar, XXX is " +
- "undefined", message);
+ "undefined", error.message);
}
}