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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user