Skip to content

Commit

Permalink
FSR-1207 | update page title to use place name
Browse files Browse the repository at this point in the history
  • Loading branch information
Ash committed Jun 25, 2024
1 parent d4d8536 commit eed12a0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion server/models/views/alerts-and-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,15 @@ class ViewModel {
floodRiskUrl: config.floodRiskUrl
})

const pageTitle = place?.name ?? location

if (error) {
this.pageTitle = 'Sorry, there is currently a problem searching a location'
} else {
if (this.station && this.station.agency_name) {
this.pageTitle = `${this.station.agency_name} - flood alerts and warnings`
} else {
this.pageTitle = `${location ? location + ' - f' : 'F'}lood alerts and warnings`
this.pageTitle = `${pageTitle ? pageTitle + ' - f' : 'F'}lood alerts and warnings`
}
}
this.countFloods = floods?.floods?.length ?? 0
Expand Down
2 changes: 1 addition & 1 deletion test/models/alerts-and-warnings.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ lab.test('Test exposed data placeBox is blank if not a place in England', async
const Result = await new ViewModel({ location, place, floods, station })

Code.expect(Result.expose.placeBbox.length).to.equal(0)
Code.expect(Result.pageTitle).to.equal('Flood alerts and warnings')
Code.expect(Result.pageTitle).to.equal('Kinghorn - flood alerts and warnings')
})

lab.test('Test count floods function returns correct number of floods', async () => {
Expand Down

0 comments on commit eed12a0

Please sign in to comment.