diff --git a/ang/civiawards/award-creation/directives/review-fields/review-field-selection.html b/ang/civiawards/award-creation/directives/review-fields/review-field-selection.html index e2ee13b5..ec18933f 100644 --- a/ang/civiawards/award-creation/directives/review-fields/review-field-selection.html +++ b/ang/civiawards/award-creation/directives/review-fields/review-field-selection.html @@ -26,11 +26,14 @@ {{reviewField.label}} {{reviewField.data_type}} diff --git a/ang/civiawards/award-creation/directives/review-fields/review-fields-table.directive.html b/ang/civiawards/award-creation/directives/review-fields/review-fields-table.directive.html index c50be364..af2b6f86 100644 --- a/ang/civiawards/award-creation/directives/review-fields/review-fields-table.directive.html +++ b/ang/civiawards/award-creation/directives/review-fields/review-fields-table.directive.html @@ -26,7 +26,9 @@ - {{getReviewFieldData(reviewField.id, 'label')}} + + {{getReviewFieldData(reviewField.id, 'label')}} + { + beforeEach(() => { + ReviewFieldsMockData[0].is_active = '0'; + }); + + afterEach(() => { + ReviewFieldsMockData[0].is_active = '1'; + }); + + describe('and the review was not selected before', () => { + beforeEach(() => { + $scope.additionalDetails = { selectedReviewFields: [] }; + + $scope.toggleReviewField(ReviewFieldsMockData[0]); + }); + + it('does not addd the clicked review field as selected', () => { + expect($scope.additionalDetails.selectedReviewFields).toEqual([]); + }); + }); + + describe('and the review was selected before', () => { + beforeEach(() => { + $scope.additionalDetails = { + selectedReviewFields: [{ + id: ReviewFieldsMockData[0].id, + required: false, + weight: 1 + }] + }; + + $scope.toggleReviewField(ReviewFieldsMockData[0]); + }); + + it('does not remove the clicked review field from selected', () => { + expect($scope.additionalDetails.selectedReviewFields[0]).toEqual({ + id: ReviewFieldsMockData[0].id, + required: false, + weight: 1 + }); + }); + }); + }); }); describe('when the REMOVE button is clicked from the review field list', () => {