Fix search screen preview tests and add snapshots

This commit is contained in:
Stefan Ceriu
2026-07-02 17:40:14 +03:00
parent a433793418
commit 4c2243cda1
21 changed files with 64 additions and 17 deletions
@@ -74,7 +74,7 @@ struct SearchScreen: View {
}
.frame(maxHeight: .infinity, alignment: .top)
.background(Color.compound.bgCanvasDefault)
.searchable(text: $context.searchQuery, placement: .toolbarPrincipal)
.conditionalSearchable(searchQuery: $context.searchQuery)
.searchFocused($isSearchFieldFocused)
.autocorrectionDisabled(true)
.background(tabShortcuts)
@@ -213,6 +213,17 @@ struct SearchScreen: View {
}
}
private extension View {
/// Searchable makes the preview contents randomly appear lower
@ViewBuilder func conditionalSearchable(searchQuery: Binding<String>) -> some View {
if !ProcessInfo.isXcodePreview, !ProcessInfo.isRunningTests {
searchable(text: searchQuery, placement: .toolbarPrincipal)
} else {
self
}
}
}
private struct SearchScreenRoomCell: View {
let room: SearchScreenRoom
let context: SearchScreenViewModel.Context