Allow removing individual search breadcrumbs

Each recent search now has a trailing close button to remove it from
the history. The view action is logged without its payload so removed
queries don't end up in the logs.
This commit is contained in:
Stefan Ceriu
2026-09-29 14:54:59 +03:00
parent 313365ad83
commit 50b38555b6
8 changed files with 72 additions and 11 deletions
@@ -149,6 +149,19 @@ struct SearchScreenViewModelTests {
#expect(userSettings.searchBreadcrumbs == [.room(roomID: "2"), .query("Second")])
}
@Test
func removingBreadcrumbs() {
userSettings.searchBreadcrumbs = [.query("Second"), .room(roomID: "2")]
context.send(viewAction: .removeBreadcrumb(.query("Second")))
#expect(userSettings.searchBreadcrumbs == [.room(roomID: "2")])
context.send(viewAction: .removeBreadcrumb(.room(SearchScreenRoom(.mock(id: "2", name: "Second")))))
#expect(userSettings.searchBreadcrumbs.isEmpty)
}
@Test
func breadcrumbsAreDisplayed() async throws {
staticRoomListSubject.send([.mock(id: "2", name: "Second")])