Skip to content

Commit

Permalink
EUI-9061: Case Flags v2 - Case Flag Summary page fix for external use…
Browse files Browse the repository at this point in the history
…r flag updates (#1643)

Fix bug where Welsh description (for flags of type "Other") and Welsh comments fields are shown on the Case Flag Summary (CYA) page when a flag is updated by an external user.
  • Loading branch information
Daniel-Lam authored Dec 12, 2023
1 parent 124f1a0 commit e6f0110
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 5 deletions.
5 changes: 4 additions & 1 deletion RELEASE-NOTES.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
## RELEASE NOTES
### Version 7.0.2-case-flags-v2-1-release-2
**EUI-9061** Fix bug where Welsh description (for flags of type "Other") and Welsh comments fields are shown on the Case Flag Summary (CYA) page when a flag is updated by an external user

### Version 7.0.2-case-flags-v2-1-release
**EUI-9048** Re-tag for re-release of Case Flags v2.1, following sync of `Release` branch with latest from `master` to incorporate Angular 15 and Node 18 upgrade

Expand Down Expand Up @@ -1690,4 +1693,4 @@ Bumped up the version
**RDM-1851** Header and footer needs to match Gov.Uk styling - Attempt to put back README to overcome a problem in npmjs

### Version 1.1.0 - May 18 2018
**RDM-1851** Header and footer needs to match Gov.Uk styling
**RDM-1851** Header and footer needs to match Gov.Uk styling
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.2-case-flags-v2-1-release",
"version": "7.0.2-case-flags-v2-1-release-2",
"engines": {
"node": ">=18.17.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.2-case-flags-v2-1-release",
"version": "7.0.2-case-flags-v2-1-release-2",
"engines": {
"node": ">=18.17.0"
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
</a>
</dd>
</div>
<div class="govuk-summary-list__row" *ngIf="flagDescriptionWelsh?.length > 0">
<div class="govuk-summary-list__row" *ngIf="flagDescriptionWelsh?.length > 0 && !externalUserUpdate">
<dt class="govuk-summary-list__key">
{{'Other description (Welsh)' | rpxTranslate}}
</dt>
Expand Down Expand Up @@ -55,7 +55,7 @@
</a>
</dd>
</div>
<div class="govuk-summary-list__row" *ngIf="flagCommentsWelsh?.length > 0">
<div class="govuk-summary-list__row" *ngIf="flagCommentsWelsh?.length > 0 && !externalUserUpdate">
<dt class="govuk-summary-list__key">
{{'Comments (Welsh)' | rpxTranslate}}
</dt>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,37 @@ describe('CaseFlagSummaryListComponent', () => {
expect(summaryListValues[5].textContent).toContain(flag.flagDetail.status);
});

it('should not display summary details for Welsh if the flag is being updated by an external user', () => {
const flag = {
partyName: 'Rose Bank',
flagDetail: {
name: 'Flag 1',
flagComment: 'First flag',
flagComment_cy: 'Flag comment for Welsh',
dateTimeCreated: new Date(),
path: [{ id: '', value: 'Reasonable adjustment' }],
hearingRelevant: false,
flagCode: 'FL1',
otherDescription_cy: 'Other description for Welsh',
status: 'Active'
} as FlagDetail
} as FlagDetailDisplay;
// Set a comment for the flag update reason (mandatory if the user is external)
flag.flagDetail['flagStatusReasonChange'] = 'Update by external user';
component.flagForSummaryDisplay = flag;
component.displayContextParameter = CaseFlagDisplayContextParameter.UPDATE_EXTERNAL;
fixture.detectChanges();
const addUpdateFlagHeaderTextElement = nativeElement.querySelector('dt');
expect(addUpdateFlagHeaderTextElement.textContent).toContain(updateSupportHeaderText);
const summaryListValues = nativeElement.querySelectorAll('dd.govuk-summary-list__value');
expect(summaryListValues.length).toBe(4);
expect(summaryListValues[0].textContent).toContain(flag.partyName);
expect(summaryListValues[1].textContent).toContain(flag.flagDetail.name);
// The flag update comment is displayed in place of the original flag comment, for an external user
expect(summaryListValues[2].textContent).toContain('Update by external user');
expect(summaryListValues[3].textContent).toContain(flag.flagDetail.status);
});

it('should use the stored Welsh values for flag name and sub-type value if the selected language is Welsh', () => {
mockRpxTranslationService.language = 'cy';
const flag = {
Expand Down

0 comments on commit e6f0110

Please sign in to comment.