From 228aa9e164e32b242402ffc25ceb7c08ac6a8e23 Mon Sep 17 00:00:00 2001 From: John Benjamin Date: Thu, 6 Jul 2023 14:22:45 +0100 Subject: [PATCH 1/5] EUI-8608 QM follow up on the query tab --- RELEASE-NOTES.md | 3 +++ package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- .../components/query-details/query-details.component.html | 2 +- 4 files changed, 6 insertions(+), 3 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 4aae43ea16..7593b6ffae 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,4 +1,7 @@ ## RELEASE NOTES +### Version 6.16.0-follow-up-on-query-tab +**EUI-8608** Query management follow up on the query tab + ### Version 6.16.0-follow-up-query-check-your-answers-v4 **EUI-8607** Query management follow up query check your answers page changes diff --git a/package.json b/package.json index 918bf7c227..f48e550339 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "6.16.0-follow-up-query-check-your-answers-v4", + "version": "6.16.0-follow-up-on-query-tab", "engines": { "yarn": "^3.5.0", "npm": "^8.10.0" diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index 08369f98d8..ff5de2f865 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "6.16.0-follow-up-query-check-your-answers-v4", + "version": "6.16.0-follow-up-on-query-tab", "engines": { "yarn": "^3.5.0", "npm": "^8.10.0" diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.html b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.html index dc15ed1b2a..e1b36cc541 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.html +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.html @@ -38,7 +38,7 @@ -
{{ 'Follow up query' | rpxTranslate }}
+
{{ 'Follow-up' | rpxTranslate }}
From 1c47d69a5d7cc044bb30d058b8709fba3145fb3f Mon Sep 17 00:00:00 2001 From: John Benjamin Date: Thu, 6 Jul 2023 17:40:32 +0100 Subject: [PATCH 2/5] EUI-8608 QM follow up on the query tab --- .../components/palette/palette.module.ts | 6 +- .../query-management/__mocks__/index.ts | 10 +- .../query-details-table.component.spec.ts | 4 +- .../query-details.component.html | 11 ++ .../query-details.component.spec.ts | 122 +++++++++++++++++- 5 files changed, 146 insertions(+), 7 deletions(-) diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/palette.module.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/palette.module.ts index 7005fc4c94..f6f983c66a 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/palette.module.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/palette.module.ts @@ -119,6 +119,8 @@ import { PaletteService } from './palette.service'; import { CasePaymentHistoryViewerFieldComponent } from './payment'; import { ReadPhoneUKFieldComponent, WritePhoneUKFieldComponent } from './phone-uk'; import { + QualifyingQuestionDetailComponent, + QualifyingQuestionOptionsComponent, QueryAttachmentsReadComponent, QueryCaseDetailsHeaderComponent, QueryCheckYourAnswersComponent, @@ -129,9 +131,7 @@ import { QueryWriteDateInputComponent, QueryWriteRaiseQueryComponent, QueryWriteRespondToQueryComponent, - ReadQueryManagementFieldComponent, - QualifyingQuestionOptionsComponent, - QualifyingQuestionDetailComponent + ReadQueryManagementFieldComponent } from './query-management'; import { ReadTextFieldComponent, WriteTextFieldComponent } from './text'; import { ReadTextAreaFieldComponent, WriteTextAreaFieldComponent } from './text-area'; diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/__mocks__/index.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/__mocks__/index.ts index 32e096ee06..edca692f24 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/__mocks__/index.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/__mocks__/index.ts @@ -73,7 +73,15 @@ export const partyMessagesMockData: PartyMessagesGroup[] = [ id: 'case-message-012', name: 'Maggie Conroy', body: 'Can I use a tablet instead?', - attachments: [], + attachments: [ + { + _links: { + self: { href: '/' }, + binary: { href: '/' }, + }, + originalDocumentName: 'tablet-document.pdf', + } + ], isHearingRelated: true, hearingDate: '10 Jan 2023', createdOn: new Date(2023, 3, 8), diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details-table/query-details-table.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details-table/query-details-table.component.spec.ts index 2f908c7e10..5a0bcbed89 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details-table/query-details-table.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details-table/query-details-table.component.spec.ts @@ -1,8 +1,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { QueryDetailsTableComponent } from './query-details-table.component'; -import { QueryListItem } from '../../models'; import { MockRpxTranslatePipe } from '../../../../../../shared/test/mock-rpx-translate.pipe'; +import { QueryListItem } from '../../models'; +import { QueryDetailsTableComponent } from './query-details-table.component'; describe('QueryDetailsTableComponent', () => { let component: QueryDetailsTableComponent; diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.html b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.html index e1b36cc541..3472f67914 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.html +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.html @@ -56,6 +56,17 @@ + + + + +
{{ 'Query detail' | rpxTranslate }} {{ child.body }}
{{ 'Attachments' | rpxTranslate }} + + +
diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts index 9d9f70933d..c614a33de4 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts @@ -1,14 +1,116 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; import { QueryDetailsComponent } from './query-details.component'; +import { QueryListItem } from '../../models'; +import { By } from '@angular/platform-browser'; +import { MockRpxTranslatePipe } from 'projects/ccd-case-ui-toolkit/src/lib/shared/test/mock-rpx-translate.pipe'; describe('QueryDetailsComponent', () => { let component: QueryDetailsComponent; let fixture: ComponentFixture; + const items = [ + { + id: '222-222', + subject: '', + name: 'Name 2', + body: 'Body 2', + attachments: [], + isHearingRelated: false, + hearingDate: '', + createdOn: new Date('2021-02-01'), + createdBy: 'Person A', + parentId: '111-111', + children: [] + }, + { + id: '333-333', + subject: '', + name: 'Name 3', + body: 'Body 3', + attachments: [], + isHearingRelated: false, + hearingDate: '', + createdOn: new Date('2021-03-01'), + createdBy: 'Person B', + parentId: '111-111', + children: [] + }, + { + id: '444-444', + subject: '', + name: 'Name 4', + body: 'Body 4', + attachments: [], + isHearingRelated: false, + hearingDate: '', + createdOn: new Date('2020-03-01'), + createdBy: 'Person C', + parentId: '222-222' + }, + // lastSubmittedBy + { + id: '555-555', + subject: '', + name: 'Name 5', + body: 'Body 5', + attachments: [], + isHearingRelated: false, + hearingDate: '', + createdOn: new Date('2023-06-01'), + createdBy: 'Person D', + parentId: '444-444', + } + ]; + + const childrenItems = items.map(item => { + const listItem = new QueryListItem(); + Object.assign(listItem, item); + return listItem; + }); + + const queryListItem = new QueryListItem(); + Object.assign(queryListItem, { + id: '111-111', + subject: 'Subject 1', + name: 'Name 1', + body: 'Body 1', + attachments: [ + { + _links: { + self: { + href: 'https://hmcts.internal/documents/111-111' + }, + binary: { + href: 'https://hmcts.internal/documents/111-111/binary' + } + }, + originalDocumentName: 'Document 1' + } + ], + isHearingRelated: true, + hearingDate: new Date('2023-06-29'), + createdOn: new Date('2023-06-25'), + createdBy: 'Person A', + children: [ + childrenItems[0], + childrenItems[1], + { + ...childrenItems[2], + children: [ + // lastSubmittedBy + childrenItems[3] + ] + } + ] + }); + beforeEach(async () => { await TestBed.configureTestingModule({ - declarations: [ QueryDetailsComponent ] + declarations: [ + QueryDetailsComponent, + MockRpxTranslatePipe + ] }) .compileComponents(); }); @@ -16,6 +118,7 @@ describe('QueryDetailsComponent', () => { beforeEach(() => { fixture = TestBed.createComponent(QueryDetailsComponent); component = fixture.componentInstance; + component.query = queryListItem; fixture.detectChanges(); }); @@ -28,4 +131,21 @@ describe('QueryDetailsComponent', () => { component.onBack(); expect(component.backClicked.emit).toHaveBeenCalled(); }); + + it('should verify table column names for response', () => { + const tables = fixture.debugElement.queryAll(By.css('.query-details-table')); + const columnHeaders = tables[0].queryAll(By.css('.govuk-table__header')); + expect(columnHeaders[0].nativeElement.textContent.trim()).toEqual('Last response date'); + expect(columnHeaders[1].nativeElement.textContent.trim()).toEqual('Response detail'); + expect(columnHeaders[2].nativeElement.textContent.trim()).toEqual('Attachments'); + }); + + it('should verify table column names for follow-up', () => { + const tables = fixture.debugElement.queryAll(By.css('.query-details-table')); + const columnHeaders = tables[1].queryAll(By.css('.govuk-table__header')); + expect(columnHeaders[0].nativeElement.textContent.trim()).toEqual('Last submission date'); + expect(columnHeaders[1].nativeElement.textContent.trim()).toEqual('Last submitted by'); + expect(columnHeaders[2].nativeElement.textContent.trim()).toEqual('Query detail'); + expect(columnHeaders[3].nativeElement.textContent.trim()).toEqual('Attachments'); + }); }); From 0129cc628c5c4adba9970915b9e782dae0da6ae7 Mon Sep 17 00:00:00 2001 From: John Benjamin Date: Fri, 7 Jul 2023 10:02:18 +0100 Subject: [PATCH 3/5] EUI-8608 QM follow up on the query tab --- RELEASE-NOTES.md | 2 +- package.json | 2 +- projects/ccd-case-ui-toolkit/package.json | 2 +- .../query-details/query-details.component.spec.ts | 7 +++---- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/RELEASE-NOTES.md b/RELEASE-NOTES.md index 7593b6ffae..779dabd62d 100644 --- a/RELEASE-NOTES.md +++ b/RELEASE-NOTES.md @@ -1,5 +1,5 @@ ## RELEASE NOTES -### Version 6.16.0-follow-up-on-query-tab +### Version 6.16.0-follow-up-on-query-tab-v2 **EUI-8608** Query management follow up on the query tab ### Version 6.16.0-follow-up-query-check-your-answers-v4 diff --git a/package.json b/package.json index f48e550339..efe75720a2 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "6.16.0-follow-up-on-query-tab", + "version": "6.16.0-follow-up-on-query-tab-v2", "engines": { "yarn": "^3.5.0", "npm": "^8.10.0" diff --git a/projects/ccd-case-ui-toolkit/package.json b/projects/ccd-case-ui-toolkit/package.json index ff5de2f865..7d687fb1f2 100644 --- a/projects/ccd-case-ui-toolkit/package.json +++ b/projects/ccd-case-ui-toolkit/package.json @@ -1,6 +1,6 @@ { "name": "@hmcts/ccd-case-ui-toolkit", - "version": "6.16.0-follow-up-on-query-tab", + "version": "6.16.0-follow-up-on-query-tab-v2", "engines": { "yarn": "^3.5.0", "npm": "^8.10.0" diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts index c614a33de4..da211a813c 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts @@ -1,9 +1,8 @@ import { ComponentFixture, TestBed } from '@angular/core/testing'; - -import { QueryDetailsComponent } from './query-details.component'; -import { QueryListItem } from '../../models'; import { By } from '@angular/platform-browser'; -import { MockRpxTranslatePipe } from 'projects/ccd-case-ui-toolkit/src/lib/shared/test/mock-rpx-translate.pipe'; +import { MockRpxTranslatePipe } from '../../../../../test/mock-rpx-translate.pipe'; +import { QueryListItem } from '../../models'; +import { QueryDetailsComponent } from './query-details.component'; describe('QueryDetailsComponent', () => { let component: QueryDetailsComponent; From 2f6539a8561ae4c2a2c1a0b5b2ed55c91dbf7b67 Mon Sep 17 00:00:00 2001 From: John Benjamin Date: Mon, 27 Nov 2023 09:23:52 +0000 Subject: [PATCH 4/5] EUI-8608 QM follow up on the query tab --- .../query-details.component.spec.ts | 26 +++++++++++-------- .../query-details/query-details.component.ts | 4 +-- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts index 11e022e5a3..fdaf01526f 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts @@ -1,7 +1,8 @@ +import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; +import { MockRpxTranslatePipe } from 'projects/ccd-case-ui-toolkit/src/lib/shared/test/mock-rpx-translate.pipe'; import { SessionStorageService } from '../../../../../services'; -import { MockRpxTranslatePipe } from '../../../../../test/mock-rpx-translate.pipe'; import { QueryListItem } from '../../models'; import { QueryDetailsComponent } from './query-details.component'; @@ -106,12 +107,20 @@ describe('QueryDetailsComponent', () => { ] }); + const USER = { + roles: [ + 'caseworker' + ] + }; + beforeEach(async () => { + mockSessionStorageService.getItem.and.returnValue(JSON.stringify(USER)); await TestBed.configureTestingModule({ declarations: [ QueryDetailsComponent, MockRpxTranslatePipe ], + schemas: [CUSTOM_ELEMENTS_SCHEMA], providers: [ {provide: SessionStorageService, useValue: mockSessionStorageService } ] }) .compileComponents(); @@ -136,15 +145,16 @@ describe('QueryDetailsComponent', () => { it('should verify table column names for response', () => { const tables = fixture.debugElement.queryAll(By.css('.query-details-table')); - const columnHeaders = tables[0].queryAll(By.css('.govuk-table__header')); + const columnHeaders = tables[1].queryAll(By.css('.govuk-table__header')); expect(columnHeaders[0].nativeElement.textContent.trim()).toEqual('Last response date'); - expect(columnHeaders[1].nativeElement.textContent.trim()).toEqual('Response detail'); - expect(columnHeaders[2].nativeElement.textContent.trim()).toEqual('Attachments'); + expect(columnHeaders[1].nativeElement.textContent.trim()).toEqual('Caseworker name'); + expect(columnHeaders[2].nativeElement.textContent.trim()).toEqual('Response detail'); + expect(columnHeaders[3].nativeElement.textContent.trim()).toEqual('Attachments'); }); it('should verify table column names for follow-up', () => { const tables = fixture.debugElement.queryAll(By.css('.query-details-table')); - const columnHeaders = tables[1].queryAll(By.css('.govuk-table__header')); + const columnHeaders = tables[2].queryAll(By.css('.govuk-table__header')); expect(columnHeaders[0].nativeElement.textContent.trim()).toEqual('Last submission date'); expect(columnHeaders[1].nativeElement.textContent.trim()).toEqual('Last submitted by'); expect(columnHeaders[2].nativeElement.textContent.trim()).toEqual('Query detail'); @@ -152,12 +162,6 @@ describe('QueryDetailsComponent', () => { }); describe('isCaseworker', () => { - const USER = { - roles: [ - 'caseworker' - ] - }; - it('should return true if the user doesnt have pui-case-manager', () => { mockSessionStorageService.getItem.and.returnValue(JSON.stringify(USER)); fixture.detectChanges(); diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.ts index ab151fb3d6..010d6d0813 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.ts @@ -12,14 +12,14 @@ export class QueryDetailsComponent { @Output() public backClicked: EventEmitter = new EventEmitter(); @Input() public caseId: string; - constructor(private sessionStorage: SessionStorageService) { } + constructor(private sessionStorageService: SessionStorageService) { } public onBack(): void { this.backClicked.emit(true); } public isCaseworker(): boolean { - const userDetails = JSON.parse(this.sessionStorage.getItem('userDetails')); + const userDetails = JSON.parse(this.sessionStorageService.getItem('userDetails')); return userDetails && userDetails.roles && !(userDetails.roles.includes('pui-case-manager') || userDetails.roles.some((role) => role.toLowerCase().includes('judge'))); From 1bc3aad6cb7b564d8eb580d4d31c41b8d3f2d2a9 Mon Sep 17 00:00:00 2001 From: John Benjamin Date: Mon, 27 Nov 2023 09:47:03 +0000 Subject: [PATCH 5/5] EUI-8608 QM follow up on the query tab --- .../components/query-details/query-details.component.spec.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts index fdaf01526f..27a5cd9151 100644 --- a/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts +++ b/projects/ccd-case-ui-toolkit/src/lib/shared/components/palette/query-management/components/query-details/query-details.component.spec.ts @@ -1,8 +1,8 @@ import { CUSTOM_ELEMENTS_SCHEMA } from '@angular/core'; import { ComponentFixture, TestBed } from '@angular/core/testing'; import { By } from '@angular/platform-browser'; -import { MockRpxTranslatePipe } from 'projects/ccd-case-ui-toolkit/src/lib/shared/test/mock-rpx-translate.pipe'; import { SessionStorageService } from '../../../../../services'; +import { MockRpxTranslatePipe } from '../../../../../test/mock-rpx-translate.pipe'; import { QueryListItem } from '../../models'; import { QueryDetailsComponent } from './query-details.component';