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 2014/08/05 19:32:04 UTC

[06/19] git commit: Transition DatasetSelectCtrl Tests

Transition DatasetSelectCtrl Tests


Project: http://git-wip-us.apache.org/repos/asf/climate/repo
Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/a624cecd
Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/a624cecd
Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/a624cecd

Branch: refs/heads/master
Commit: a624cecde227aeb8fc29ca1aa21dbae29f4a5227
Parents: 663e5bd
Author: Michael Joyce <jo...@apache.org>
Authored: Fri Jul 25 16:44:58 2014 -0700
Committer: Michael Joyce <jo...@apache.org>
Committed: Mon Aug 4 15:01:01 2014 -0700

----------------------------------------------------------------------
 .../test/spec/controllers/datasetselect.js      | 21 ++++++++++++++++----
 1 file changed, 17 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/climate/blob/a624cecd/ocw-ui/frontend-new/test/spec/controllers/datasetselect.js
----------------------------------------------------------------------
diff --git a/ocw-ui/frontend-new/test/spec/controllers/datasetselect.js b/ocw-ui/frontend-new/test/spec/controllers/datasetselect.js
index 50267b6..abaeb43 100644
--- a/ocw-ui/frontend-new/test/spec/controllers/datasetselect.js
+++ b/ocw-ui/frontend-new/test/spec/controllers/datasetselect.js
@@ -19,7 +19,7 @@
 
 'use strict';
 
-describe('Controller: DatasetselectCtrl', function () {
+describe('Controller: DatasetSelectCtrl', function () {
 
   // load the controller's module
   beforeEach(module('ocwUiApp'));
@@ -30,12 +30,25 @@ describe('Controller: DatasetselectCtrl', function () {
   // Initialize the controller and a mock scope
   beforeEach(inject(function ($controller, $rootScope) {
     scope = $rootScope.$new();
-    DatasetselectCtrl = $controller('DatasetselectCtrl', {
+    DatasetselectCtrl = $controller('DatasetSelectCtrl', {
       $scope: scope
     });
   }));
 
-  it('should attach a list of awesomeThings to the scope', function () {
-    expect(scope.awesomeThings.length).toBe(3);
+  it('should initialize the disable clear button function', function() {
+    inject(function(selectedDatasetInformation) {
+      expect(scope.shouldDisableClearButton()).toBe(true);
+      selectedDatasetInformation.addDataset({});
+      expect(scope.shouldDisableClearButton()).toBe(false);
+    });
+  });
+
+  it('should initialize the clear datasets function', function() {
+    inject(function(selectedDatasetInformation) {
+      selectedDatasetInformation.addDataset({});
+      expect(selectedDatasetInformation.getDatasetCount()).toBe(1);
+      scope.clearDatasets();
+      expect(selectedDatasetInformation.getDatasetCount()).toBe(0);
+    });
   });
 });