Skip to content

Commit

Permalink
Merge pull request #1145 from ministryofjustice/CAS-505-fe-update-the…
Browse files Browse the repository at this point in the history
…-bedspace-search-component-to-include-selection-of-specified-bedspace-attributes

CAS-505 Add "Wheelchair accessible" bedspace attribute to bedspace search filters
  • Loading branch information
aliuk2012 authored Nov 20, 2024
2 parents 7f7b207 + 2b5565c commit 370441e
Show file tree
Hide file tree
Showing 3 changed files with 65 additions and 29 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -64,11 +64,21 @@ export default class BedspaceSearchPage extends Page {
this.checkCheckboxByNameAndValue('probationDeliveryUnits[]', pdu)
})

this.getLegend('Bedspace attributes')
this.getLegend('Property attributes')
this.getLegend('Occupancy (optional)')
searchParameters.attributes.forEach(attribute => {
this.checkCheckboxByNameAndValue('attributes[]', attribute)
})
searchParameters.attributes
.filter(attribute => attribute === 'wheelchairAccessible')
.forEach(attribute => {
this.checkCheckboxByNameAndValue('attributes[]', attribute)
})

this.getLegend('Bedspace attributes')
this.getLegend('Accessibility (optional)')
searchParameters.attributes
.filter(attribute => attribute !== 'wheelchairAccessible')
.forEach(attribute => {
this.checkCheckboxByNameAndValue('attributes[]', attribute)
})
}

clickBedspaceLink(room: Room) {
Expand Down
2 changes: 1 addition & 1 deletion server/testutils/factories/bedSearchParameters.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
import { DateFormats } from '../../utils/dateUtils'
import referenceData from './referenceData'

const bedSearchAttributes: Array<BedSearchAttributes> = ['singleOccupancy', 'sharedProperty']
const bedSearchAttributes: Array<BedSearchAttributes> = ['singleOccupancy', 'sharedProperty', 'wheelchairAccessible']

export default Factory.define<BedSearchAPIParameters>(() => ({
startDate: DateFormats.dateObjToIsoDate(faker.date.soon()),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -57,27 +57,53 @@
fieldName: "probationDeliveryUnits"
}, fetchContext()) }}

{% call govukFieldset({
legend: {
text: "Bedspace attributes",
classes: "govuk-fieldset__legend--m"
}
}) %}
{{ formPageCheckboxes({
classes: "govuk-checkboxes--small",
fieldName: "attributes",
fieldset: {
legend: {
text: "Occupancy (optional)",
classes: "govuk-fieldset__legend--s"
}
},
hint: {
text: "Select all that apply"
},
items: [
{ text: "Single", value: "singleOccupancy" },
{ text: "Shared", value: "sharedProperty" }
]
}, fetchContext()) }}
{% endcall %}
<section>
<div class="govuk-form-group">
{% call govukFieldset({
legend: {
text: "Property attributes",
classes: "govuk-fieldset__legend--m"
}
}) %}
{{ formPageCheckboxes({
classes: "govuk-checkboxes--small",
fieldName: "attributes",
fieldset: {
legend: {
text: "Occupancy (optional)",
classes: "govuk-fieldset__legend--s"
}
},
hint: {
text: "Select all that apply"
},
items: [
{ text: "Single", value: "singleOccupancy" },
{ text: "Shared", value: "sharedProperty" }
]
}, fetchContext()) }}
{% endcall %}
</div>
<div class="govuk-form-group">
{% call govukFieldset({
legend: {
text: "Bedspace attributes",
classes: "govuk-fieldset__legend--m"
}
}) %}
{{ formPageCheckboxes({
classes: "govuk-checkboxes--small",
fieldName: "attributes",
fieldset: {
legend: {
text: "Accessibility (optional)",
classes: "govuk-fieldset__legend--s"
}
},
items: [
{ text: "Wheelchair accessible", value: "wheelchairAccessible" }
]
}, fetchContext()) }}
{% endcall %}
</div>
</section>

0 comments on commit 370441e

Please sign in to comment.