Fix RoomDetailsEditScreen snapshot rendering issues by switching their 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.
This commit is contained in:
committed by
Stefan Ceriu
parent
21a4d6c471
commit
5c8cb16e33
@@ -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)
|
||||
}
|
||||
.previewDisplayName("Normal")
|
||||
.snapshot(delay: 0.25)
|
||||
|
||||
NavigationStack {
|
||||
RoomDetailsEditScreen(context: readOnlyViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Read only")
|
||||
.snapshot(delay: 0.25)
|
||||
|
||||
NavigationStack {
|
||||
RoomDetailsEditScreen(context: editableViewModel.context)
|
||||
}
|
||||
.previewDisplayName("Editable")
|
||||
.snapshot(delay: 0.25)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,3 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:ebc6b817dfa1d00ea2df807000b31ac6dde10b217ca993870ca35676fbd7f892
|
||||
size 68317
|
||||
@@ -1,3 +0,0 @@
|
||||
version https://git-lfs.github.com/spec/v1
|
||||
oid sha256:c98a2f1252910cfa40e0463e4682aab8ae3f095dce8b71d98027000a6ae81430
|
||||
size 66827
|
||||
Reference in New Issue
Block a user