From b5f3d7fe4c244df4a8f550b00484da122af7078e Mon Sep 17 00:00:00 2001 From: Patrick Fleming Date: Thu, 11 Jul 2024 15:59:07 +0100 Subject: [PATCH] Link to premises and bed from OOS bed page --- .../outOfServiceBeds/outOfServiceBedShow.ts | 14 ++++++++++++++ .../future_manager/viewsOutOfServiceBed.cy.ts | 3 +++ .../outOfServiceBeds/partials/_pageHeading.njk | 7 +++++-- 3 files changed, 22 insertions(+), 2 deletions(-) diff --git a/integration_tests/pages/v2Manage/outOfServiceBeds/outOfServiceBedShow.ts b/integration_tests/pages/v2Manage/outOfServiceBeds/outOfServiceBedShow.ts index 1590b54333..a4bf4a83cd 100644 --- a/integration_tests/pages/v2Manage/outOfServiceBeds/outOfServiceBedShow.ts +++ b/integration_tests/pages/v2Manage/outOfServiceBeds/outOfServiceBedShow.ts @@ -85,4 +85,18 @@ export class OutOfServiceBedShowPage extends Page { clickUpdateRecord(): void { cy.get('a').contains('Update record').click() } + + shouldLinkToPremisesAndBed(outOfServiceBed: OutOfServiceBed) { + cy.get('a') + .contains(outOfServiceBed.premises.name) + .should('have.attr', 'href', paths.v2Manage.premises.show({ premisesId: outOfServiceBed.premises.id })) + + cy.get('a') + .contains(outOfServiceBed.bed.name) + .should( + 'have.attr', + 'href', + paths.v2Manage.premises.beds.show({ premisesId: outOfServiceBed.premises.id, bedId: outOfServiceBed.bed.id }), + ) + } } diff --git a/integration_tests/tests/v2Manage/future_manager/viewsOutOfServiceBed.cy.ts b/integration_tests/tests/v2Manage/future_manager/viewsOutOfServiceBed.cy.ts index a31bf4de68..9abdf03569 100644 --- a/integration_tests/tests/v2Manage/future_manager/viewsOutOfServiceBed.cy.ts +++ b/integration_tests/tests/v2Manage/future_manager/viewsOutOfServiceBed.cy.ts @@ -38,6 +38,9 @@ context('OutOfServiceBeds', () => { // And I should see the bed characteristics page.shouldShowCharacteristics(bedDetail) + // And I should see links to the premises and bed in the page heading + page.shouldLinkToPremisesAndBed(outOfServiceBed) + // When I click the 'Timeline' tab page.clickTab('Timeline') diff --git a/server/views/v2Manage/outOfServiceBeds/partials/_pageHeading.njk b/server/views/v2Manage/outOfServiceBeds/partials/_pageHeading.njk index e0d98da66d..cf3b236e96 100644 --- a/server/views/v2Manage/outOfServiceBeds/partials/_pageHeading.njk +++ b/server/views/v2Manage/outOfServiceBeds/partials/_pageHeading.njk @@ -1,5 +1,8 @@ {% macro outOfServiceBedPageHeading(title, outOfServiceBed)%} - {{outOfServiceBed.premises.name}} - Room {{outOfServiceBed.room.name}} | Bed {{outOfServiceBed.bed.name}} + + {{outOfServiceBed.premises.name}} + + Room {{outOfServiceBed.room.name}} | Bed {{outOfServiceBed.bed.name}} +

{{title}}

{%endmacro%}