Skip to content

Commit

Permalink
exui-771-update task link based on hash key (#3257)
Browse files Browse the repository at this point in the history
* exui-771-update task link based on hash key

* bug/exui-771-update-task-link: Setting Preview Deployment ID

* exui-331-remove web config

* exui-834-preferredHearingChannel set to NA for paperHearing (#3277)

* exui-834-preferredHearingChannel to NA paperHearin

* exui-834-paper-hearing-data: Setting Preview Deployment ID

* cve

---------

Co-authored-by: RiteshHMCTS <[email protected]>

---------

Co-authored-by: RiteshHMCTS <[email protected]>
  • Loading branch information
RiteshHMCTS and RiteshHMCTS authored Oct 12, 2023
1 parent 7a5492a commit 81fc97e
Show file tree
Hide file tree
Showing 5 changed files with 26 additions and 3 deletions.
3 changes: 1 addition & 2 deletions angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,7 @@
"output": "/assets"
},
"src/favicon.ico",
"src/assets",
"src/web.config"
"src/assets"
],
"styles": [
"src/styles.scss"
Expand Down
7 changes: 7 additions & 0 deletions src/cases/components/case-task/case-task.util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,4 +76,11 @@ describe('CaseTaskUtil', () => {
const appendedTaskDescription = appendTaskIdAsQueryStringToTaskDescription(taskToCheck);
expect(appendedTaskDescription).toEqual('');
});

it('should return fragment appended to url after taskId', () => {
const taskToCheck = task;
taskToCheck.description = '[Review the Referral](/cases/case-details/${[CASE_REFERENCE]}#Referrals)';
const appendedTaskDescription = appendTaskIdAsQueryStringToTaskDescription(taskToCheck);
expect(appendedTaskDescription).toEqual('[Review the Referral](/cases/case-details/${[CASE_REFERENCE]}?tid=0d22d838-b25a-11eb-a18c-f2d58a9b7bc6#Referrals)');
});
});
10 changes: 9 additions & 1 deletion src/cases/components/case-task/case-task.util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,15 @@ export const appendTaskIdAsQueryStringToTaskDescription = (task: Task): string =
markdownList.forEach((markdown) => {
if (markdown) {
const taskIdQueryString = markdown.includes('?') ? `&tid=${task.id}` : `?tid=${task.id}`;
newTaskDescription += markdown.includes('/') ? `${markdown}${taskIdQueryString})` : `${markdown})`;
if (markdown.includes('#')) {
const hashText = markdown.substring(markdown.indexOf('#'));
const taskDescription = markdown.slice(0, markdown.indexOf('#'));
newTaskDescription += `${taskDescription}${taskIdQueryString}${hashText})`;
} else if (markdown.includes('/')) {
newTaskDescription += `${markdown}${taskIdQueryString})`;
} else {
newTaskDescription += `${markdown})`;
}
}
});
return newTaskDescription;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,11 @@ describe('HearingAttendanceComponent', () => {
expect(component.isFormValid()).toEqual(true);
});

it('should return NA for preferredHearingChannel when paper hearings has set to Yes', () => {
component.attendanceFormGroup.controls.paperHearing.setValue(RadioOptions.YES);
expect(component.getIndividualParties()[0].individualDetails.preferredHearingChannel).toEqual('NA');
});

it('should true when calling isFormValid with partyChannel', () => {
component.attendanceFormGroup.controls.estimation.setValue(1);
(component.attendanceFormGroup.controls.parties as FormArray).controls.forEach((element: AbstractControl) => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,11 @@ export class HearingAttendanceComponent extends RequestHearingPageFlow implement

public getIndividualParties(): PartyDetailsModel[] {
const individualParties: PartyDetailsModel[] = [];
const onPeperHearing = this.attendanceFormGroup.controls.paperHearing.value === RadioOptions.YES;
(this.attendanceFormGroup.controls.parties as FormArray).controls.forEach((control) => {
if (onPeperHearing) {
control.value.individualDetails.preferredHearingChannel = 'NA';
}
const partyDetail: PartyDetailsModel = {
partyID: control.value.partyID,
partyType: control.value.partyType,
Expand Down

0 comments on commit 81fc97e

Please sign in to comment.