Skip to content

Commit

Permalink
Fix RoomDetailsEditScreen snapshot rendering issues by switching thei…
Browse files Browse the repository at this point in the history
…r order. The root problems seems to be async related but we couldn't get to the bottom of it. Take this opportunity to refactor the snapshots.
  • Loading branch information
stefanceriu committed Mar 27, 2024
1 parent b3f3198 commit 974686b
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,32 +156,37 @@ struct RoomDetailsEditScreen: View {
// MARK: - Previews

struct RoomDetailsEditScreen_Previews: PreviewProvider, TestablePreview {
static let viewModel = RoomDetailsEditScreenViewModel(roomProxy: RoomProxyMock(with: .init(id: "test_id",
name: "Room",
members: [.mockMeAdmin])),
mediaProvider: MockMediaProvider(),
userIndicatorController: UserIndicatorControllerMock.default)
static let editableViewModel = {
let roomProxy = RoomProxyMock(with: .init(id: "test_id",
name: "Room",
members: [.mockMeAdmin]))

return RoomDetailsEditScreenViewModel(roomProxy: roomProxy,
mediaProvider: MockMediaProvider(),
userIndicatorController: UserIndicatorControllerMock.default)
}()

static let readOnlyViewModel = {
let accountOwner = RoomMemberProxyMock.mockMe
return RoomDetailsEditScreenViewModel(roomProxy: RoomProxyMock(with: .init(id: "test_id",
name: "Room",
members: [.mockMe])),
let roomProxy = RoomProxyMock(with: .init(id: "test_id",
name: "Room",
members: [.mockAlice]))

return RoomDetailsEditScreenViewModel(roomProxy: roomProxy,
mediaProvider: MockMediaProvider(),
userIndicatorController: UserIndicatorControllerMock.default)
}()

static var previews: some View {
NavigationStack {
RoomDetailsEditScreen(context: viewModel.context)
RoomDetailsEditScreen(context: readOnlyViewModel.context)
}
.previewDisplayName("Normal")
.previewDisplayName("Read only")
.snapshot(delay: 0.25)

NavigationStack {
RoomDetailsEditScreen(context: readOnlyViewModel.context)
RoomDetailsEditScreen(context: editableViewModel.context)
}
.previewDisplayName("Read only")
.previewDisplayName("Editable")
.snapshot(delay: 0.25)
}
}
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

This file was deleted.

0 comments on commit 974686b

Please sign in to comment.