Skip to content

Commit

Permalink
Merge 06fcc35 into 74940e7
Browse files Browse the repository at this point in the history
  • Loading branch information
rladdusaw committed Dec 13, 2019
2 parents 74940e7 + 06fcc35 commit 6888b66
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 2 deletions.
10 changes: 10 additions & 0 deletions app/controllers/activeSprintsController.js
Expand Up @@ -57,6 +57,16 @@ app.controller('ActiveSprintsController', function ($controller, $sce, $scope, A
return $scope.activeSprints.length > 0 ? $scope.activeSprints[sessionStorage.selected] : undefined;
};

$scope.getPanelClass = function (type) {
var panelClass = 'panel-default';
if (type === 'Feature') {
panelClass = 'panel-primary';
} else if (type === 'Defect') {
panelClass = 'panel-danger';
}
return panelClass;
};

ActiveSprintsService.updated.then(null, null, function () {
if ($scope.activeSprints.length > 0) {
while (sessionStorage.selected >= $scope.activeSprints.length) {
Expand Down
2 changes: 1 addition & 1 deletion app/views/home.html
Expand Up @@ -50,7 +50,7 @@
<div class="panel-heading">{{status.identifier}}</div>
<div class="panel-body">

<div ng-repeat="card in getSelectedSprint().cards | filter:{'status': status.identifier}" class="panel kanban-card" ng-class="{'panel-primary': card.type === 'Feature', 'panel-danger': card.type === 'Defect'}">
<div ng-repeat="card in getSelectedSprint().cards | filter:{'status': status.identifier}" class="panel kanban-card" ng-class="getPannelClass(card.type)">
<div class="panel-heading">
<span>{{card.number}}</span>
<span ng-repeat="assignee in card.assignees">
Expand Down
2 changes: 1 addition & 1 deletion karma.conf.js
Expand Up @@ -121,7 +121,7 @@ module.exports = function (config) {

frameworks: ['jasmine'],

browsers: ['Chrome', 'Firefox'],
browsers: ['ChromeHeadless', 'Firefox'],

plugins: [
'karma-chrome-launcher',
Expand Down
13 changes: 13 additions & 0 deletions tests/unit/controllers/activeSprintsControlerTest.js
Expand Up @@ -53,6 +53,10 @@ describe('controller: ActiveSprintsController', function () {
expect(scope.getSelectedSprint).toBeDefined();
expect(typeof scope.getSelectedSprint).toEqual('function');
});
it('getPanelClass should be defined', function () {
expect(scope.getPanelClass).toBeDefined();
expect(typeof scope.getPanelClass).toEqual('function');
});
});

describe('Do the scope methods work as expected', function () {
Expand Down Expand Up @@ -95,6 +99,15 @@ describe('controller: ActiveSprintsController', function () {
var selectedSprint = scope.getSelectedSprint();
expect(selectedSprint).toEqual(scope.activeSprints[0]);
});

it('getPanelClass should return correct value', function() {
var featureClass = scope.getPanelClass('Feature');
var defectClass = scope.getPanelClass('Defect');
var otherClass = scope.getPanelClass('anything else');
expect(featureClass).toEqual('panel-primary');
expect(defectClass).toEqual('panel-danger');
expect(otherClass).toEqual('panel-default');
});
});

});

0 comments on commit 6888b66

Please sign in to comment.