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/21 06:07:24 UTC

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

Author: joyce
Date: Fri Jun 21 04:07:24 2013
New Revision: 1495284

URL: http://svn.apache.org/r1495284
Log:
CLIMATE-130 progress - Add option array init tests.

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

Modified: incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ObservationSelectCtrlTest.js
URL: http://svn.apache.org/viewvc/incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ObservationSelectCtrlTest.js?rev=1495284&r1=1495283&r2=1495284&view=diff
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ObservationSelectCtrlTest.js (original)
+++ incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ObservationSelectCtrlTest.js Fri Jun 21 04:07:24 2013
@@ -39,5 +39,27 @@ describe('OCW Controllers', function() {
 				expect(Object.keys(scope.datasetCount).length).toBe(0);
 			});
 		});
+
+		it('should initialize option arrays and default to the first element', function() {
+			inject(function($httpBackend, $rootScope, $controller) {
+				$rootScope.baseURL = "http://localhost:8082"
+				$httpBackend.expectJSONP($rootScope.baseURL + '/getPathLeader/?callback=JSON_CALLBACK').
+					respond(200, {'leader': '/usr/local/rcmes'});
+
+				var scope = $rootScope.$new();
+				var ctrl = $controller("ObservationSelectCtrl", {$scope: scope});
+				$httpBackend.flush();
+
+				expect(scope.params.length).toBe(1);
+				expect(scope.lats.length).toBe(1);
+				expect(scope.lons.length).toBe(1);
+				expect(scope.times.length).toBe(1);
+
+				expect(scope.params[0]).toEqual("Please select a file above");
+				expect(scope.lats[0]).toEqual("Please select a file above");
+				expect(scope.lons[0]).toEqual("Please select a file above");
+				expect(scope.times[0]).toEqual("Please select a file above");
+			});
+		});
 	});
 });