Skip to content

Commit

Permalink
Merge branch 'master' into csfd-15-ungrey-back-button
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh-HMCTS committed Oct 28, 2024
2 parents bdc05ee + b9e29d3 commit 259391a
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 5 deletions.
4 changes: 4 additions & 0 deletions RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
## RELEASE NOTES

### Version 7.0.71
**EXUI-EXUI-2227** error-handling-specific-access-request

### Version 7.0.70
**EXUI-2193** Get rid of mc-menu-items LD flag
**EXUI-2346** Not able to see unavailable dates on check your answers page
Expand All @@ -12,6 +15,7 @@
**EXUI-2146** Case file view time is 1 hour behind
**EXUI-2230** Case File View date/time as GMT rather than Local BST


### Version 7.0.66
**EXUI-2148** Additional checks on task completion from session storage
**EXUI-2057** A frozen screen is seen when attempting to complete a current task...
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.0.70-ungrey-back-button",
"version": "7.0.71-ungrey-back-button",
"engines": {
"node": ">=18.19.0"
},
Expand Down
2 changes: 1 addition & 1 deletion projects/ccd-case-ui-toolkit/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@hmcts/ccd-case-ui-toolkit",
"version": "7.0.70-ungrey-back-button",
"version": "7.0.71-ungrey-back-button",
"engines": {
"node": ">=18.19.0"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<exui-error-message
*ngIf="formGroup.invalid && submitted"
*ngIf="(formGroup.invalid && submitted) || getSpecificAccessError"
[error]="errorMessage"></exui-error-message>
<cut-alert type="information">
{{'Authorisation is needed to access this case.' | rpxTranslate}}<br />
Expand All @@ -18,7 +18,6 @@ <h1 class="govuk-fieldset__heading">
<details class="govuk-details" data-module="govuk-details" role="group">
<summary
class="govuk-details__summary"
role="button"
aria-expanded="false">
<span class="govuk-details__summary-text">
{{'Help with requesting case access' | rpxTranslate}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ describe('CaseSpecificAccessRequestComponent', () => {
beforeEach(waitForAsync(() => {
casesService = createSpyObj<CasesService>('casesService', ['createSpecificAccessRequest']);
casesService.createSpecificAccessRequest.and.returnValue(of(true));
casesNotifier.fetchAndRefresh.and.returnValue(of(true));
TestBed.configureTestingModule({
declarations: [CaseSpecificAccessRequestComponent, ErrorMessageComponent, MockRpxTranslatePipe,
StubComponent],
Expand Down Expand Up @@ -104,6 +105,24 @@ describe('CaseSpecificAccessRequestComponent', () => {
expect(errorMessageElement).toBeNull();
});

it('should return error when API call fails', () => {
casesService.createSpecificAccessRequest.and.returnValue(of({
errorCode: '500',
status: '500',
errorMessage: 'Internal Server Error',
timeStamp: new Date()
}));
const submitButton = fixture.debugElement.nativeElement.querySelector('button[type="submit"]');
const otherReason = fixture.debugElement.nativeElement.querySelector('#specific-reason');
otherReason.value = 'Test';
otherReason.dispatchEvent(new Event('input'));
submitButton.click();
fixture.detectChanges();
expect(component.formGroup.invalid).toBe(false);
const errorBannerElement = fixture.debugElement.nativeElement.querySelector('.govuk-error-summary');
expect(errorBannerElement).toBeDefined();
});

it('should go back to the page before previous one when the \"Cancel\" link is clicked', fakeAsync(() => {
const cancelLink = fixture.debugElement.nativeElement.querySelector('a.govuk-body');
expect(cancelLink.text).toContain('Cancel');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class CaseSpecificAccessRequestComponent implements OnDestroy, OnInit {

private readonly genericError = 'There is a problem';
private readonly specificReasonControlName = 'specificReason';
public getSpecificAccessError = false;

constructor(
private readonly fb: FormBuilder,
Expand Down Expand Up @@ -97,10 +98,16 @@ export class CaseSpecificAccessRequestComponent implements OnDestroy, OnInit {
() => {
// Would have been nice to pass the caseId within state.data, but this isn't part of NavigationExtras until
// Angular 7.2
this.getSpecificAccessError = false;
this.router.navigate(['success'], { relativeTo: this.route });
},
() => {
// Navigate to error page
// Show the generic error message
this.getSpecificAccessError = true;
this.errorMessage = {
title: this.genericError,
description: 'Sorry, there is a problem with the service; Try again later.'
};
}
);
}
Expand Down

0 comments on commit 259391a

Please sign in to comment.