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:16:40 UTC
svn commit: r1493997 - in
/incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers: ./
ParameterSelectCtrl.js
Author: joyce
Date: Tue Jun 18 03:16:40 2013
New Revision: 1493997
URL: http://svn.apache.org/r1493997
Log:
CLIMATE-116 progress - Add tests for ParameterSelectCtrl
- Move ParameterSelectCtrl tests to separate file.
- Add test to check for spatial/temporal range default value
initialization and proper dataset service communication. It's possible
that this test is better suited in the service's test but for now it
is added here.
Added:
incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/
incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js
Added: 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=1493997&view=auto
==============================================================================
--- incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js (added)
+++ incubator/climate/trunk/rcmet/src/main/ui/test/unit/controllers/ParameterSelectCtrl.js Tue Jun 18 03:16:40 2013
@@ -0,0 +1,37 @@
+'use strict';
+
+describe('OCW Controllers', function() {
+
+ beforeEach(module('ocw.controllers'));
+ beforeEach(module('ocw.services'));
+
+
+ describe('ParameterSelectCtrl', function() {
+ it('initialize spatial and temporal range default values properly', function() {
+ inject(function($rootScope, $controller) {
+ var scope = $rootScope.$new(),
+ ctrl = $controller("ParameterSelectCtrl", {$scope: scope});
+
+ expect(scope.latMin).toBe(-90);
+ expect(scope.latMax).toBe(90);
+ expect(scope.lonMin).toBe(-180);
+ expect(scope.lonMax).toBe(180);
+ expect(scope.start).toBe("1980-01-01 00:00:00");
+ expect(scope.end).toBe("2030-01-01 00:00:00");
+ });
+ });
+
+ it('grab the default set of selected datasets from the service', function() {
+ inject(function($rootScope, $controller) {
+ var scope = $rootScope.$new();
+ var ctrl = $controller("ParameterSelectCtrl", {$scope: scope});
+
+ // We should get an object with no keys since the user hasn't selected any
+ // datasets by default. Object.keys returns an array of all the user defined
+ // keys in the object.
+ expect(typeof scope.datasets).toBe('object');
+ expect(Object.keys(scope.datasets).length).toBe(0);
+ });
+ });
+ });
+});