Added the "navigationTitle" property to the ContentViewModel view model in the Sample app target to update the navigation title to show the selected locale.

This commit is contained in:
2026-07-07 00:59:40 +02:00
parent d27e5fb38f
commit 3dc5b2b7fc
4 changed files with 43 additions and 3 deletions
@@ -256,6 +256,38 @@ struct ContentViewModelTests {
}
// MARK: Navigation Title
@MainActor
@Suite("Navigation title")
struct NavigationTitle {
@Test
func `navigation title names the selected locale`() {
let model = Model(preinstaller: PreinstallingMock())
model.locale = .english
#expect(String(localized: model.navigationTitle) == "Transcribe to \(model.name(for: .english))")
}
@Test
func `navigation title updates when the locale changes`() {
let model = Model(preinstaller: PreinstallingMock())
model.locale = .english
let english = String(localized: model.navigationTitle)
model.locale = .dutch
let dutch = String(localized: model.navigationTitle)
#expect(english == "Transcribe to \(model.name(for: .english))")
#expect(dutch == "Transcribe to \(model.name(for: .dutch))")
#expect(english != dutch)
}
}
}
// MARK: - Constants