Transition DatasetDisplayCtrl tests
Project: http://git-wip-us.apache.org/repos/asf/climate/repo Commit: http://git-wip-us.apache.org/repos/asf/climate/commit/663e5bd6 Tree: http://git-wip-us.apache.org/repos/asf/climate/tree/663e5bd6 Diff: http://git-wip-us.apache.org/repos/asf/climate/diff/663e5bd6 Branch: refs/heads/master Commit: 663e5bd6977ea1106c535ad4a7ac8066d3fc1ae3 Parents: 5a6db3f Author: Michael Joyce <[email protected]> Authored: Fri Jul 25 16:29:28 2014 -0700 Committer: Michael Joyce <[email protected]> Committed: Mon Aug 4 15:01:01 2014 -0700 ---------------------------------------------------------------------- .../test/spec/controllers/datasetdisplay.js | 28 ++++++++++++++++---- 1 file changed, 23 insertions(+), 5 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/climate/blob/663e5bd6/ocw-ui/frontend-new/test/spec/controllers/datasetdisplay.js ---------------------------------------------------------------------- diff --git a/ocw-ui/frontend-new/test/spec/controllers/datasetdisplay.js b/ocw-ui/frontend-new/test/spec/controllers/datasetdisplay.js index 75d0927..15a4a02 100644 --- a/ocw-ui/frontend-new/test/spec/controllers/datasetdisplay.js +++ b/ocw-ui/frontend-new/test/spec/controllers/datasetdisplay.js @@ -19,23 +19,41 @@ 'use strict'; -describe('Controller: DatasetdisplayctrlCtrl', function () { +describe('Controller: DatasetDisplayCtrl', function () { // load the controller's module beforeEach(module('ocwUiApp')); var DatasetdisplayctrlCtrl, - scope; + scope; // Initialize the controller and a mock scope beforeEach(inject(function ($controller, $rootScope) { scope = $rootScope.$new(); - DatasetdisplayctrlCtrl = $controller('DatasetdisplayctrlCtrl', { + DatasetdisplayctrlCtrl = $controller('DatasetDisplayCtrl', { $scope: scope }); })); - it('should attach a list of awesomeThings to the scope', function () { - expect(scope.awesomeThings.length).toBe(3); + it('should initialize the removeDataset function', function() { + scope.datasets.push(1); + scope.datasets.push(2); + + expect(scope.datasets[0]).toBe(1); + + scope.removeDataset(0); + + expect(scope.datasets[0]).toBe(2); + }); + + it('should initialize the removeDataset function', function() { + scope.datasets.push(1); + scope.datasets.push(2); + + expect(scope.datasets[0]).toBe(1); + + scope.removeDataset(0); + + expect(scope.datasets[0]).toBe(2); }); });
