Skip to content

Commit 03da625

Browse files
authored
Merge pull request #2990 from compucorp/PCHR-4537-remove-leave-request-notes
PCHR-4537: Remove leave request notes
2 parents 51b252e + 8428453 commit 03da625

File tree

7 files changed

+72
-26
lines changed

7 files changed

+72
-26
lines changed

uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/absence-tab.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/admin-dashboard.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/manager-leave.min.js

+4-4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uk.co.compucorp.civicrm.hrleaveandabsences/js/dist/my-leave.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

uk.co.compucorp.civicrm.hrleaveandabsences/js/src/leave-absences/shared/services/leave-popup.service.js

+9-1
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@ define([
1818
];
1919

2020
function LeavePopupService ($log, $rootElement, $rootScope, $modal, notification, sharedSettings, DateFormat, Session, LeaveRequest) {
21+
var BACKDROP_CLICK_EVENT_NAME = 'backdrop click';
22+
2123
$log.debug('LeavePopup');
2224

2325
return {
@@ -67,7 +69,13 @@ define([
6769
return DateFormat.getDateFormat();
6870
}]
6971
}
70-
});
72+
})
73+
.result
74+
.catch(function (error) {
75+
if (error !== BACKDROP_CLICK_EVENT_NAME) {
76+
throw error;
77+
}
78+
});
7179
}
7280

7381
/**

uk.co.compucorp.civicrm.hrleaveandabsences/js/test/shared/services/leave-popup.service.spec.js

+56
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ define([
2727

2828
spyOn(LeaveRequest, 'find');
2929
spyOn(notification, 'error');
30+
$uibModal.open.and.returnValue({
31+
result: $q.resolve()
32+
});
3033
}));
3134

3235
describe('openModal()', function () {
@@ -68,6 +71,59 @@ define([
6871
.directiveOptions().defaultStatus).toBe(defaultStatus);
6972
});
7073
});
74+
75+
describe('resolving the modal', function () {
76+
describe('when the modal resolves as normal', function () {
77+
beforeEach(function () {
78+
$uibModal.open.and.returnValue({
79+
result: $q.resolve()
80+
});
81+
82+
LeavePopup.openModal();
83+
});
84+
85+
it('does not emit an error', function () {
86+
expect(function () {
87+
$rootScope.$digest();
88+
})
89+
.not.toThrow();
90+
});
91+
});
92+
93+
describe('when the modal is rejected by the "backdrop click" event', function () {
94+
beforeEach(function () {
95+
$uibModal.open.and.returnValue({
96+
result: $q.reject('backdrop click')
97+
});
98+
99+
LeavePopup.openModal();
100+
});
101+
102+
it('does not emit an error', function () {
103+
expect(function () {
104+
$rootScope.$digest();
105+
})
106+
.not.toThrow();
107+
});
108+
});
109+
110+
describe('when the modal is rejected by any reason other than the "backdrop click" event', function () {
111+
beforeEach(function () {
112+
$uibModal.open.and.returnValue({
113+
result: $q.reject('another reason')
114+
});
115+
116+
LeavePopup.openModal();
117+
});
118+
119+
it('emits an error', function () {
120+
expect(function () {
121+
$rootScope.$digest();
122+
})
123+
.toThrow();
124+
});
125+
});
126+
});
71127
});
72128

73129
describe('openModalByID()', function () {

uk.co.compucorp.civicrm.hrleaveandabsences/views/shared/components/leave-request-popup/leave-request-popup-body.html

-18
Original file line numberDiff line numberDiff line change
@@ -94,24 +94,6 @@
9494
</div>
9595
</div>
9696
</div>
97-
<div ng-show="$ctrl.request.selectedResponse == 3">
98-
<div class="col-xs-12">Please add a comment:</div>
99-
<div class="col-xs-12">
100-
<div
101-
class="chr_wysiwyg"
102-
text-angular
103-
prevent-animations
104-
ta-toolbar="[['bold','italics','underline']]"
105-
ng-model="myleave.request.responseComment"></div>
106-
<div class="chr_wysiwyg__action">
107-
<hr/>
108-
<button class="btn btn-link">
109-
<i class="fa fa-comment-o" aria-hidden="true"></i>
110-
Add comment
111-
</button>
112-
</div>
113-
</div>
114-
</div>
11597
</div>
11698
</div>
11799
</div>

0 commit comments

Comments
 (0)