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:29 UTC
svn commit: r1495285 -
/incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ObservationSelectCtrlTest.js
Author: joyce
Date: Fri Jun 21 04:07:29 2013
New Revision: 1495285
URL: http://svn.apache.org/r1495285
Log:
CLIMATE-130 progress - Add scope parameter init test
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=1495285&r1=1495284&r2=1495285&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:29 2013
@@ -61,5 +61,27 @@ describe('OCW Controllers', function() {
expect(scope.times[0]).toEqual("Please select a file above");
});
});
+
+ it('should initialize scope attributes properly', 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.pathLeader).toEqual('/usr/local/rcmes');
+ expect(scope.loadingFile).toBe(false);
+ expect(scope.fileAdded).toBe(false);
+ expect(typeof scope.latLonVals).toEqual('object');
+ expect(scope.latLonVals.length).toBe(0);
+ expect(typeof scope.timeVals).toEqual('object');
+ expect(scope.timeVals.length).toEqual(0);
+ expect(typeof scope.localSelectForm).toEqual('object');
+ expect(Object.keys(scope.localSelectForm).length).toEqual(0);
+ });
+ });
});
});