You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@climate.apache.org by jo...@apache.org on 2013/06/18 05:17:52 UTC

svn commit: r1494012 - /incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js

Author: joyce
Date: Tue Jun 18 03:17:52 2013
New Revision: 1494012

URL: http://svn.apache.org/r1494012
Log:
CLIMATE-116 progress - Add checkParameters test

Modified:
    incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js

Modified: incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js?rev=1494012&r1=1494011&r2=1494012&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js Tue Jun 18 03:17:52 2013
@@ -138,5 +138,33 @@ describe('OCW Controllers', function() {
 				expect(scope.datasets.length).toBe(0);
 			});
 		});
+
+		it('should initialize the check parameters function', function() {
+			inject(function($rootScope, $controller) {
+				var scope = $rootScope.$new();
+				var ctrl = $controller("ParameterSelectCtrl", {$scope: scope});
+
+				// Set the displayParams values to be "out of bounds" values so checkParams 
+				// adjusts them properly.
+				scope.displayParams.latMin = "-95";
+				scope.displayParams.latMax = "95";
+				scope.displayParams.lonMin = "-185";
+				scope.displayParams.lonMax = "185";
+				scope.displayParams.start = "1980-00-00 00:00:00";
+				scope.displayParams.end = "2031-01-01 00:00:00";
+
+				// If we don't remove the watch on datasets we end up with displayParam values 
+				// all being undefined (but only during testing, which is odd...)
+				scope.unwatchDatasets();
+				scope.checkParameters();
+
+				expect(scope.displayParams.latMin).toBe(-90);
+				expect(scope.displayParams.latMax).toBe(90);
+				expect(scope.displayParams.lonMin).toBe(-180);
+				expect(scope.displayParams.lonMax).toBe(180);
+				expect(scope.displayParams.start).toBe('1980-01-01 00:00:00');
+				expect(scope.displayParams.end).toBe('2030-01-01 00:00:00');
+			});
+		});
 	});
 });