Skip to content

Commit

Permalink
Merge pull request #1986 from ministryofjustice/APS-1049-link-from-OO…
Browse files Browse the repository at this point in the history
…SB-to-premises-and-room

APS 1049 - link to premises and bed from OOS bed page
  • Loading branch information
patrickjfl authored Jul 12, 2024
2 parents a38c1d6 + b5f3d7f commit 45e3ad8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 }),
)
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -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')

Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
{% macro outOfServiceBedPageHeading(title, outOfServiceBed)%}
<span class="govuk-caption-l">{{outOfServiceBed.premises.name}}</span>
<span class="govuk-caption-l">Room {{outOfServiceBed.room.name}} | Bed {{outOfServiceBed.bed.name}}</span>
<span class="govuk-caption-l">
<a href="{{paths.v2Manage.premises.show({premisesId: outOfServiceBed.premises.id})}}">{{outOfServiceBed.premises.name}}</a>
</span>
<span class="govuk-caption-l">Room {{outOfServiceBed.room.name}} | <a href="{{paths.v2Manage.premises.beds.show({premisesId: outOfServiceBed.premises.id, bedId: outOfServiceBed.bed.id})}}">Bed {{outOfServiceBed.bed.name}}</a>
</span>
<h1 class="govuk-heading-l">{{title}}</h1>
{%endmacro%}

0 comments on commit 45e3ad8

Please sign in to comment.