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 20:50:07 UTC

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

Author: joyce
Date: Tue Jun 18 18:50:06 2013
New Revision: 1494247

URL: http://svn.apache.org/r1494247
Log:
Resolved CLIMATE-122 - Add tests for DatasetDisplayCtrl

- Add setRegridBase test.

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

Modified: incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/DatasetDisplayCtrlTest.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/DatasetDisplayCtrlTest.js?rev=1494247&r1=1494246&r2=1494247&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/DatasetDisplayCtrlTest.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/DatasetDisplayCtrlTest.js Tue Jun 18 18:50:06 2013
@@ -40,5 +40,26 @@ describe('OCW Controllers', function() {
 				expect(scope.datasets[0]).toBe(2);
 			});
 		});
+
+		it('should initialize the setRegridBase function', function() {
+			inject(function($rootScope, $controller) {
+				var scope = $rootScope.$new();
+				var ctrl = $controller("DatasetDisplayCtrl", {$scope: scope});
+
+				scope.datasets.push({regrid: false});
+				scope.datasets.push({regrid: true});
+				scope.datasets.push({regrid: true});
+				scope.datasets.push({regrid: false});
+
+				expect(scope.datasets[1].regrid).toBe(true);
+				expect(scope.datasets[2].regrid).toBe(true);
+				
+				// setRegridBase should set all indices to 'false' if if it's not the passed index
+			    scope.setRegridBase(2);
+
+				expect(scope.datasets[1].regrid).toBe(false);
+				expect(scope.datasets[2].regrid).toBe(true);
+			});
+		});
 	});
 });