[pollen] branch feature/validVoteCounting updated (9d6c3a2 -> 510da4d)
This is an automated email from the git hooks/post-receive script. New change to branch feature/validVoteCounting in repository pollen. See http://git.chorem.org/pollen.git from 9d6c3a2 check vote value new 510da4d Improve UI The 1 revisions listed above as "new" are entirely new to this repository and will be described in separate emails. The revisions listed as "adds" were already present in the repository and have only been added to this reference. Detailed log of new commits: commit 510da4db1a53a7a2e2a0107ba143ccbb532a37dc Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Fri Jul 25 16:41:10 2014 +0200 Improve UI Summary of changes: pollen-ui-angular/src/main/webapp/js/app.js | 9 ++- .../src/main/webapp/js/controllers/pollCtrl.js | 75 +++++++++++++--------- pollen-ui-angular/src/main/webapp/less/style.less | 72 +++++++++------------ .../src/main/webapp/less/variables.less | 39 ++++++++++- .../src/main/webapp/partials/inline-poll.html | 8 +-- .../src/main/webapp/partials/poll.html | 36 ++++++++--- .../src/test/unit/pollControllersTest.js | 35 ++-------- 7 files changed, 154 insertions(+), 120 deletions(-) -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
This is an automated email from the git hooks/post-receive script. New commit to branch feature/validVoteCounting in repository pollen. See http://git.chorem.org/pollen.git commit 510da4db1a53a7a2e2a0107ba143ccbb532a37dc Author: Adrien Garandel <a.garandel@dralagen.fr> Date: Fri Jul 25 16:41:10 2014 +0200 Improve UI --- pollen-ui-angular/src/main/webapp/js/app.js | 9 ++- .../src/main/webapp/js/controllers/pollCtrl.js | 75 +++++++++++++--------- pollen-ui-angular/src/main/webapp/less/style.less | 72 +++++++++------------ .../src/main/webapp/less/variables.less | 39 ++++++++++- .../src/main/webapp/partials/inline-poll.html | 8 +-- .../src/main/webapp/partials/poll.html | 36 ++++++++--- .../src/test/unit/pollControllersTest.js | 35 ++-------- 7 files changed, 154 insertions(+), 120 deletions(-) diff --git a/pollen-ui-angular/src/main/webapp/js/app.js b/pollen-ui-angular/src/main/webapp/js/app.js index ef73d67..48db8dd 100644 --- a/pollen-ui-angular/src/main/webapp/js/app.js +++ b/pollen-ui-angular/src/main/webapp/js/app.js @@ -59,12 +59,11 @@ angular.module('pollen', ['pollenDirective', 'pollenServices', 'ngRoute', 'Polle .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/', {templateUrl: './partials/home.html', controller: "HomeCtrl"}) - .when('/poll/home/:pollId/:pollToken?', {templateUrl: './partials/poll.html', controller: "PollCtrl"}) .when('/poll/create/:tab?', {templateUrl: './partials/poll.html', controller: "PollCreateCtrl"}) - .when('/poll/edit/:pollId/:pollToken?/:tab?', {templateUrl: './partials/poll.html', controller:"PollEditCtrl"}) - .when('/poll/vote/:pollId/:voteToken?', {templateUrl: './partials/poll.html', controller :"PollVoteCtrl"}) - .when('/poll/result/:pollId/:token?', {templateUrl: './partials/poll.html', controller :"PollResultCtrl"}) - .when('/poll/comment/:pollId/:commentToken?', {templateUrl: './partials/poll.html', controller :"PollCommentCtrl"}) + .when('/poll/edit/:pollId/:pollToken?/:tab?', {templateUrl: './partials/poll.html', controller:"PollCtrl"}) + .when('/poll/vote/:pollId/:voteToken?', {templateUrl: './partials/poll.html', controller :"PollCtrl"}) + .when('/poll/result/:pollId/:token?', {templateUrl: './partials/poll.html', controller :"PollCtrl"}) + .when('/poll/comment/:pollId/:commentToken?', {templateUrl: './partials/poll.html', controller :"PollCtrl"}) .when('/poll/list/:cmd?', {templateUrl: './partials/poll-list.html', controller :"PollListCtrl"}) .when('/user/list', {templateUrl: './partials/user-list.html', controller:"UserListCtrl"}) .when('/user/register', {templateUrl: './partials/user-register.html', controller:"UserRegisterCtrl"}) diff --git a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js index 95eab88..ca432f5 100644 --- a/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js +++ b/pollen-ui-angular/src/main/webapp/js/controllers/pollCtrl.js @@ -33,37 +33,46 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr if (angular.isDefined($routeParams.tab)) { return $routeParams.tab; } - else { + + if (angular.isDefined($route.current)) { + var params = $route.current.$$route.originalPath.split('/'); + + return params[2]; + } + + if (angular.isDefined(defaultValue)) { return defaultValue; } + + return null; }; $scope.tab = $scope.setTab('home'); if (angular.isUndefined($scope.globalVariables)) { $scope.globalVariables = {}; + } - $scope.session = SessionStorage.get(); - $scope.globalVariables.minify = $scope.session.menuMinify; + $scope.session = SessionStorage.get(); + $scope.globalVariables.minify = $scope.session.menuMinify; - /** - * Sauvegarde du token si non connecté - */ - if (angular.isUndefined($routeParams.pollToken) && angular.isUndefined($scope.session.id)) { // pas de paramètre url et non connecté - if (angular.isDefined($scope.session.pollToken) && $scope.session.pollToken != '') { // existe une permission - $scope.globalVariables.pollToken = $scope.session.pollToken; - } + /** + * Sauvegarde du token si non connecté + */ + if (angular.isUndefined($routeParams.pollToken) && angular.isUndefined($scope.session.id)) { // pas de paramètre url et non connecté + if (angular.isDefined($scope.session.pollToken) && $scope.session.pollToken != '') { // existe une permission + $scope.globalVariables.pollToken = $scope.session.pollToken; } - else if (angular.isDefined($scope.session.id)) { // connecté - if (angular.isDefined($scope.session.pollToken)) { // connecté => pas besoin de permission - SessionStorage.remove('pollToken'); - } - } - else { //token dans l'URL - SessionStorage.save({pollToken:$routeParams.pollToken}); - $scope.globalVariables.pollToken = $routeParams.pollToken; + } + else if (angular.isDefined($scope.session.id)) { // connecté + if (angular.isDefined($scope.session.pollToken)) { // connecté => pas besoin de permission + SessionStorage.remove('pollToken'); } } + else { //token dans l'URL + SessionStorage.save({pollToken:$routeParams.pollToken}); + $scope.globalVariables.pollToken = $routeParams.pollToken; + } $scope.toggleMinify = function () { $scope.globalVariables.minify = ! $scope.globalVariables.minify @@ -312,9 +321,9 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr .controller('PollAdminCtrl', ['$scope', '$rootScope', '$controller', '$modal', '$timeout', '$routeParams', 'Poll', function ($scope, $rootScope, $controller, $modal, $timeout, $routeParams, Poll) { - $controller('PollCtrl', {$scope:$scope}); - - $scope.tab = $scope.setTab('edit'); + if (angular.isUndefined($scope.globalVariables)) { + $scope.globalVariables = {}; + } $scope.globalVariables.editMode = true; $scope.globalVariables.voted = angular.isDefined($scope.data.votants); @@ -573,11 +582,13 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr .controller('PollCreateCtrl', ['$scope', '$rootScope', '$controller', '$location', 'Poll', 'SessionStorage', 'PollVoterList', 'Page', function ( $scope, $rootScope, $controller, $location, Poll, SessionStorage, PollVoterList, Page) { + $controller('PollCtrl', {$scope:$scope}); $controller('PollAdminCtrl', {$scope:$scope}); Page.setTitle('title.poll.create'); $scope.globalVariables.create = true; + $scope.globalVariables.minify = true; var initPoll = function () { Poll.skeletonNew(function (poll) { @@ -996,12 +1007,12 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr .controller('PollVoteCtrl', ['$scope', '$rootScope', '$q', '$controller', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$location', 'Page', function ($scope, $rootScope, $q, $controller, $routeParams, Poll, PollChoice, PollVote, $translate, $location, Page) { - $controller('PollCtrl', {$scope:$scope}); + if (angular.isUndefined($scope.globalVariables)) { + $scope.globalVariables = {}; + } Page.setTitle('title.poll.vote'); - $scope.tab = $scope.setTab('vote'); - var initPoll = function () { if ($scope.data.poll.isClosed) { $rootScope.$broadcast('newWarning', 'poll.closed', -1); @@ -1147,7 +1158,7 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.toggleValue = function (choice, event) { if ($scope.voteCountingIsBoolean()) { - if (angular.isUndefined(choice.voteValue)) { + if (choice.voteValue == null) { choice.voteValue = true; } else { @@ -1164,7 +1175,10 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr .controller('PollCommentCtrl', ['$scope', '$rootScope', '$controller', '$routeParams', 'Poll', 'PollComment', '$translate', '$timeout', '$location', 'Page', function ( $scope, $rootScope, $controller, $routeParams, Poll, PollComment, $translate, $timeout, $location, Page) { - $controller('PollCtrl', {$scope:$scope}); + + if (angular.isUndefined($scope.globalVariables)) { + $scope.globalVariables = {}; + } Page.setTitle('title.poll.comment'); @@ -1172,10 +1186,6 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr $scope.commentToken = $routeParams.commentToken; } - $scope.tab = $scope.setTab('comment'); - - //$scope.globalVariables.commentMode = true; - $scope.comment = {text:''}; var initAuthor = function () { if (angular.isDefined($scope.session.user)) { @@ -1323,7 +1333,9 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr .controller('PollResultCtrl', ['$scope', '$q', '$controller', '$route', '$routeParams', 'Poll', 'PollChoice', 'PollVote', '$translate', '$filter', '$timeout', 'Page', function ($scope, $q, $controller, $route, $routeParams, Poll, PollChoice, PollVote, $translate, $filter, $timeout, Page) { - $controller('PollCtrl', {$scope:$scope}); + if (angular.isUndefined($scope.globalVariables)) { + $scope.globalVariables = {}; + } Page.setTitle('title.poll.result'); @@ -1333,7 +1345,6 @@ angular.module('pollControllers', ['ngRoute', 'pollenServices', 'pascalprecht.tr 'other' : "{{ 'poll.result.title.other' | translate:{nbVoter:data.result.nbVotant} }}", }; - $scope.tab = $scope.setTab('result'); $scope.plot = 'chart'; $timeout(function () { diff --git a/pollen-ui-angular/src/main/webapp/less/style.less b/pollen-ui-angular/src/main/webapp/less/style.less index d32bbe5..d67b103 100644 --- a/pollen-ui-angular/src/main/webapp/less/style.less +++ b/pollen-ui-angular/src/main/webapp/less/style.less @@ -30,6 +30,10 @@ } #content { margin-top:60px; + + #poll-content .anim-fade { + .fade(); + } } /* global min width */ @@ -86,8 +90,7 @@ z-index:50; &.mini-link-remove { - -webkit-transition:width linear @short-time-transition; - transition:width linear @short-time-transition; + .transition(width linear @short-time-transition); ul li .text, ul li input { display: none; @@ -96,8 +99,7 @@ } &.mini-link { - -webkit-transition:width linear @short-time-transition; - transition:width linear @short-time-transition; + .transition(width linear @short-time-transition); width: @width-min; @@ -139,14 +141,12 @@ margin-left: @width-max; &.maxi-content-remove { - -webkit-transition:margin linear @short-time-transition; - transition:margin linear @short-time-transition; + .transition(margin linear @short-time-transition); } &.maxi-content { margin-left: @width-min; - -webkit-transition:margin linear @short-time-transition; - transition:margin linear @short-time-transition; + .transition(margin linear @short-time-transition); } label.label-block { @@ -218,11 +218,21 @@ .pollAnim { background-color:inherit; - transition-duration:@time-transition; + .transition-duration(@time-transition); &:hover { background:@borderColor; - transition-duration: @time-transition; + .transition-duration(@time-transition); + + .voteTrue { + background-color: lighten(@brand-success, 15%); + .transition-duration(@time-transition); + } + + .voteFalse { + background-color: lighten(@brand-danger, 15%); + .transition-duration(@time-transition); + } } } @@ -265,7 +275,6 @@ input[type=text]{ - height:25px; width:140px; } input[type=checkbox]{ @@ -275,10 +284,12 @@ &.voteTrue { background-color: lighten(@brand-success, 30%); + .transition-duration(@time-transition); } &.voteFalse { background-color: lighten(@brand-danger, 30%); + .transition-duration(@time-transition); } } @@ -348,19 +359,19 @@ .danger { color: @danger-color; - transition-duration:@short-time-transition; + .transition-duration(@short-time-transition); &:hover, &:focus { color: @danger-hover-color; - transition-duration:@short-time-transition; + .transition-duration(@short-time-transition); } } a { - transition-duration:@short-time-transition; + .transition-duration(@short-time-transition); &:hover, &:focus { - transition-duration:@short-time-transition; + .transition-duration(@short-time-transition); } } @@ -382,11 +393,11 @@ a { tr { background-color:inherit; - transition-duration:@time-transition; + .transition-duration(@time-transition); &:hover { background:@borderColor; - transition-duration: @time-transition; + .transition-duration(@time-transition); } td { @@ -451,11 +462,11 @@ hr { padding:8px; border: 1px solid @borderColor; } - transition-duration: @time-transition; + .transition-duration(@time-transition); &:hover { background: @borderColor; - transition-duration: @time-transition; + .transition-duration(@time-transition); } } } @@ -491,8 +502,8 @@ hr { background-color:@borderColor; border-radius:8px; - transition-duration: @time-transition; - transition-property:width,height; + .transition(width @time-transition linear 0); + .transition(height @time-transition linear 0); span { display:block; @@ -506,22 +517,3 @@ hr { } } } - -.ng-enter, .ng-leave { - -webkit-transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) @short-time-transition; - transition:all cubic-bezier(0.250, 0.460, 0.450, 0.940) @short-time-transition; -} - -.ng-leave { - height:0px; -} - -.ng-enter, -.ng-leave.ng-leave-active { - opacity:0; -} - -.ng-leave, -.ng-enter.ng-enter-active { - opacity:1; -} diff --git a/pollen-ui-angular/src/main/webapp/less/variables.less b/pollen-ui-angular/src/main/webapp/less/variables.less index 6d102cd..b917511 100644 --- a/pollen-ui-angular/src/main/webapp/less/variables.less +++ b/pollen-ui-angular/src/main/webapp/less/variables.less @@ -34,4 +34,41 @@ @responsive-min-width : 770px; @responsive-height: 600px; -@preview-size:200px; \ No newline at end of file +@preview-size:200px; + +.transition(@style) { + -webkit-transition : @style; + -moz-transition : @style; + transition : @style; +} + +.transition-duration(@time) { + -webkit-transition-duration : @time; + -moz-transition-duration : @time; + transition-duration : @time; +} + +.fade() { + &.ng-enter { + .transition(all @short-time-transition ease @short-time-transition); + } + + &.ng-leave { + .transition(all @short-time-transition ease); + } + + &.ng-leave { + height:0px; + } + + &.ng-enter, + &.ng-leave.ng-leave-active { + opacity:0; + } + + &.ng-leave, + &.ng-enter.ng-enter-active { + opacity:1; + } + +} \ No newline at end of file diff --git a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html index 15b850e..9137fa3 100644 --- a/pollen-ui-angular/src/main/webapp/partials/inline-poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/inline-poll.html @@ -74,7 +74,7 @@ </td> <td ng-repeat="choice in data.vote.choice" class="pollChoice" ng-click="toggleValue(choice, $event);"> <input-error error="choice.restError[0]" data="choice.voteValue"> - <input type="{{data.voteCountingType.renderType}}" class="form-control" name="{{choice.choiceId}}" ng-model="choice.voteValue" ng-click="toggleValue(choice, $event);" /> + <input type="{{data.voteCountingType.renderType}}" ng-class="{'form-control':(data.voteCountingType.renderType != 'checkbox')}" name="{{choice.choiceId}}" ng-model="choice.voteValue" ng-click="toggleValue(choice, $event);" /> </input-error> </td> <td> @@ -86,11 +86,11 @@ <!-- begin print vote --> <tr ng-repeat="vote in data.votants track by $index" class="pollAnim"> <td class="pollChoice"> {{vote.voterName}}</td> - <td ng-repeat="choice in vote.choice" class="pollChoice" ng-class="{voteTrue:choice.voteValue, voteFalse:!choice.voteValue}"> - <div ng-show="data.voteCountingType.renderType == checkbox"> + <td ng-repeat="choice in vote.choice" class="pollChoice" ng-class="{voteTrue:choice.voteValue != null, voteFalse:(choice.voteValue == null || (choice.voteValue == false && data.voteCountingType.renderType == 'checkbox'))}"> + <div ng-show="data.voteCountingType.renderType == 'checkbox'"> <input type="checkbox" ng-model="choice.voteValue" disabled /> </div> - <div ng-show="data.voteCountingType.renderType != checkbox"> + <div ng-show="data.voteCountingType.renderType != 'checkbox'"> {{choice.voteValue}} </div> </td> diff --git a/pollen-ui-angular/src/main/webapp/partials/poll.html b/pollen-ui-angular/src/main/webapp/partials/poll.html index ac7d5c1..d29a04c 100644 --- a/pollen-ui-angular/src/main/webapp/partials/poll.html +++ b/pollen-ui-angular/src/main/webapp/partials/poll.html @@ -19,26 +19,44 @@ #L% --> -<div id="poll-content" ng-class="{'maxi-content': globalVariables.minify || !data.poll.id}"> +<div id="poll-content" ng-class="{'maxi-content': globalVariables.minify}"> <ul class="nav nav-tabs"> <li ng-class="{active: tab == 'vote'}" ng-show="data.poll.id"><a href="{{globalVariables.linkVote}}" ng-click="tab = 'vote'">{{ 'poll.tab.vote' | translate }}</a></li> <li ng-class="{active: tab == 'comment'}" ng-show="data.poll.commentIsVisible"><a href="{{globalVariables.linkComment}}" ng-click="tab = 'comment'">{{ 'poll.tab.comment' | translate }}</a></li> <li ng-class="{active: tab == 'result'}" ng-show="data.poll.resultIsVisible"><a href="{{globalVariables.linkResult}}" ng-click="tab = 'result'">{{ 'poll.tab.result' | translate }}</a></li> - <li ng-class="{active: tab == 'edit'}" ng-show="globalVariables.create"><a href="#/poll/create" ng-click="tab = 'edit'">{{ 'poll.tab.create' | translate }}</a></li> <li ng-class="{active: tab == 'edit'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkEdit}}" ng-click="tab = 'edit'">{{ 'poll.tab.edit' | translate }}</a></li> - <li ng-class="{active: tab == 'conf'}" ng-show="data.poll.permission || globalVariables.create"><a href="{{globalVariables.linkConf || '#/poll/create/conf'}}" ng-click="tab = 'conf'">{{ 'poll.tab.conf' | translate }}</a></li> - <li ng-class="{active: tab == 'participant'}" ng-show="data.poll.permission || globalVariables.create"><a href="{{globalVariables.linkParticipant || '#/poll/create/participant'}}" ng-click="tab = 'participant'">{{ 'poll.tab.participant' | translate }}</a></li> + <li ng-class="{active: tab == 'conf'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkConf}}" ng-click="tab = 'conf'">{{ 'poll.tab.conf' | translate }}</a></li> + <li ng-class="{active: tab == 'participant'}" ng-show="data.poll.permission"><a href="{{globalVariables.linkParticipant}}" ng-click="tab = 'participant'">{{ 'poll.tab.participant' | translate }}</a></li> + + <li ng-class="{active: tab == 'create'}" ng-show="globalVariables.create"><a href="#/poll/create" ng-click="tab = 'create'">{{ 'poll.tab.create' | translate }}</a></li> + <li ng-class="{active: tab == 'conf'}" ng-show="globalVariables.create"><a href="#/poll/create/conf" ng-click="tab = 'conf'">{{ 'poll.tab.conf' | translate }}</a></li> + <li ng-class="{active: tab == 'participant'}" ng-show="globalVariables.create"><a href="#/poll/create/participant" ng-click="tab = 'participant'">{{ 'poll.tab.participant' | translate }}</a></li> </ul> - <div ng-include="'./partials/poll-poll.html'" ng-if="tab == 'edit' || tab == 'vote'"></div> + <div ng-include="'./partials/poll-poll.html'" ng-if="tab == 'vote'" ng-controller="PollVoteCtrl" class="anim-fade"></div> + + <div ng-if="!globalVariables.create && (tab == 'edit' || tab == 'conf' || tab == 'participant')" ng-controller="PollEditCtrl"> + <div ng-include="'./partials/poll-poll.html'" ng-if="tab == 'edit'" class="anim-fade"></div> + + <div ng-include="'./partials/poll-settings.html'" ng-if="tab == 'conf'" class="anim-fade"></div> + + <div ng-include="'./partials/poll-listParticipant.html'" ng-if="tab == 'participant'" class="anim-fade"></div> + </div> + + <div ng-if="globalVariables.create && (tab == 'create' || tab == 'conf' || tab == 'participant')"> + + <div ng-include="'./partials/poll-poll.html'" ng-if="tab == 'create'" class="anim-fade"></div> + + <div ng-include="'./partials/poll-settings.html'" ng-if="tab == 'conf'" class="anim-fade"></div> + + <div ng-include="'./partials/poll-listParticipant.html'" ng-if="tab == 'participant'" class="anim-fade"></div> + </div> - <div ng-include="'./partials/poll-settings.html'" ng-if="tab == 'conf'"></div> - <div ng-include="'./partials/poll-comment.html'" ng-if="tab == 'comment'"></div> + <div ng-include="'./partials/poll-comment.html'" ng-if="tab == 'comment'" ng-controller="PollCommentCtrl" class="anim-fade"></div> - <div ng-include="'./partials/poll-result.html'" ng-if="tab == 'result'"></div> + <div ng-include="'./partials/poll-result.html'" ng-if="tab == 'result'" ng-controller="PollResultCtrl" class="anim-fade"></div> - <div ng-include="'./partials/poll-listParticipant.html'" ng-if="tab == 'participant'"></div> </div> diff --git a/pollen-ui-angular/src/test/unit/pollControllersTest.js b/pollen-ui-angular/src/test/unit/pollControllersTest.js index a9c5083..2b843fb 100644 --- a/pollen-ui-angular/src/test/unit/pollControllersTest.js +++ b/pollen-ui-angular/src/test/unit/pollControllersTest.js @@ -7,11 +7,11 @@ describe('Global poll controller', function () { beforeEach(module('pollControllers')); beforeEach(inject(function($controller) { - $scope = {}; ctrl = $controller('PollCtrl', {$scope: $scope}); })); var $scope = {}; + var $route; var ctrl = null; it('should load PollCtrl', function () { expect(ctrl).toBeDefined(); @@ -19,10 +19,6 @@ describe('Global poll controller', function () { }); - it('should set good default tab', function() { - - expect($scope.tab).toEqual('home'); - }); it('should set good default dateFormat', function() { expect($scope.globalVariables.dateFormat).not.toBeNull(); @@ -183,7 +179,7 @@ describe('Global poll controller', function () { describe('Admin poll controller', function () { beforeEach(module('pollControllers')); beforeEach(inject(function($controller) { - $scope = {}; + $controller('PollCtrl', {$scope: $scope}); ctrl = $controller('PollAdminCtrl', {$scope: $scope}); })); @@ -195,10 +191,6 @@ describe('Admin poll controller', function () { expect(ctrl).not.toBeNull(); }); - it('should set good default tab', function() { - expect($scope.tab).toEqual('edit'); - }); - it('should be on edited mode', function () { expect($scope.globalVariables.editMode).toBeTruthy(); }); @@ -277,9 +269,6 @@ describe('Create poll Controller', function () { expect(ctrl).toBeDefined(); }); - it('should set good default tab', function() { - expect($scope.tab).toEqual('edit'); - }); it('should be on edited mode', function () { expect($scope.globalVariables.editMode).toBeTruthy(); @@ -303,6 +292,7 @@ describe('Create poll Controller', function () { describe('Edit poll controller', function () { beforeEach(module('pollControllers')); beforeEach(inject(function($controller) { + $controller('PollCtrl', {$scope: $scope}); ctrl = $controller('PollEditCtrl', {$scope:$scope}); })); @@ -313,10 +303,6 @@ describe('Edit poll controller', function () { expect(ctrl).toBeDefined(); }); - it('should set good default tab', function() { - expect($scope.tab).toEqual('edit'); - }); - it('should be on edited mode', function () { expect($scope.globalVariables.editMode).toBeTruthy(); }); @@ -364,6 +350,7 @@ describe('Edit poll controller', function () { describe('Vote poll controller', function () { beforeEach(module('pollControllers')); beforeEach(inject(function($controller) { + $controller('PollCtrl', {$scope: $scope}); ctrl = $controller('PollVoteCtrl', {$scope:$scope}); })); @@ -374,10 +361,6 @@ describe('Vote poll controller', function () { expect(ctrl).toBeDefined(); }); - it('should set good default tab', function() { - expect($scope.tab).toEqual('vote'); - }); - it('should not be on edited mode', function () { expect($scope.globalVariables.editMode).toBeFalsy(); }); @@ -424,6 +407,7 @@ describe('Vote poll controller', function () { describe('Poll comment controller', function () { beforeEach(module('pollControllers')); beforeEach(inject(function($controller) { + $controller('PollCtrl', {$scope: $scope}); ctrl = $controller('PollCommentCtrl', {$scope:$scope}); })); @@ -434,10 +418,6 @@ describe('Poll comment controller', function () { expect(ctrl).toBeDefined(); }); - it('should set good default tab', function() { - expect($scope.tab).toEqual('comment'); - }); - it('should not be on edited mode', function () { expect($scope.globalVariables.editMode).toBeFalsy(); }); @@ -483,6 +463,7 @@ describe('Poll comment controller', function () { describe('Poll result controller', function () { beforeEach(module('pollControllers')); beforeEach(inject(function($controller) { + $controller('PollCtrl', {$scope: $scope}); ctrl = $controller('PollResultCtrl', {$scope:$scope}); })); @@ -493,10 +474,6 @@ describe('Poll result controller', function () { expect(ctrl).toBeDefined(); }); - it('should set good default tab', function() { - expect($scope.tab).toEqual('result'); - }); - it('should not be on edited mode', function () { expect($scope.globalVariables.editMode).toBeFalsy(); }); -- To stop receiving notification emails like this one, please contact chorem.org SCM administrator <admin+scm@chorem.org>.
participants (1)
-
chorem.org scm