mirror of
https://github.com/vector-im/element-ios.git
synced 2024-09-29 07:42:40 +00:00
App Layout: added space invites in space bottom sheet
- Improved UI tests
This commit is contained in:
parent
be573b0a8a
commit
e5a2f07765
3 changed files with 13 additions and 7 deletions
|
@ -46,7 +46,7 @@ enum MockSpaceSelectorScreenState: MockScreenState, CaseIterable {
|
|||
case .initialList:
|
||||
service = MockSpaceSelectorService()
|
||||
case .selection:
|
||||
service = MockSpaceSelectorService(selectedSpaceId: MockSpaceSelectorService.defaultSpaceList[2].id)
|
||||
service = MockSpaceSelectorService(selectedSpaceId: MockSpaceSelectorService.defaultSpaceList[3].id)
|
||||
}
|
||||
let viewModel = SpaceSelectorViewModel.makeViewModel(service: service, showCancel: true)
|
||||
|
||||
|
|
|
@ -23,10 +23,11 @@ class MockSpaceSelectorService: SpaceSelectorServiceProtocol {
|
|||
static let homeItem = SpaceSelectorListItemData(id: SpaceSelectorConstants.homeSpaceId, avatar: nil, icon: UIImage(systemName: "house"), displayName: "All Chats", notificationCount: 0, highlightedNotificationCount: 0, hasSubItems: false)
|
||||
static let defaultSpaceList = [
|
||||
homeItem,
|
||||
SpaceSelectorListItemData(id: "!aaabaa:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Default Space", notificationCount: 0, highlightedNotificationCount: 0, hasSubItems: false),
|
||||
SpaceSelectorListItemData(id: "!zzasds:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Space with sub items", notificationCount: 0, highlightedNotificationCount: 0, hasSubItems: true),
|
||||
SpaceSelectorListItemData(id: "!scthve:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Space with notifications", notificationCount: 55, highlightedNotificationCount: 0, hasSubItems: true),
|
||||
SpaceSelectorListItemData(id: "!ferggs:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Space with highlight", notificationCount: 99, highlightedNotificationCount: 50, hasSubItems: false)
|
||||
SpaceSelectorListItemData(id: "!lennfd:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Invited sapce", notificationCount: 0, highlightedNotificationCount: 0, hasSubItems: false, isJoined: false),
|
||||
SpaceSelectorListItemData(id: "!aaabaa:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Default Space", notificationCount: 0, highlightedNotificationCount: 0, hasSubItems: false, isJoined: true),
|
||||
SpaceSelectorListItemData(id: "!zzasds:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Space with sub items", notificationCount: 0, highlightedNotificationCount: 0, hasSubItems: true, isJoined: true),
|
||||
SpaceSelectorListItemData(id: "!scthve:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Space with notifications", notificationCount: 55, highlightedNotificationCount: 0, hasSubItems: true, isJoined: true),
|
||||
SpaceSelectorListItemData(id: "!ferggs:matrix.org", avatar: nil, icon: UIImage(systemName: "number"), displayName: "Space with highlight", notificationCount: 99, highlightedNotificationCount: 50, hasSubItems: false, isJoined: true)
|
||||
]
|
||||
|
||||
var spaceListSubject: CurrentValueSubject<[SpaceSelectorListItemData], Never>
|
||||
|
|
|
@ -26,10 +26,15 @@ class SpaceSelectorUITests: MockScreenTestCase {
|
|||
XCTAssertEqual(disclosureButtons.count, MockSpaceSelectorService.defaultSpaceList.filter { $0.hasSubItems }.count)
|
||||
|
||||
let notificationBadges = app.staticTexts.matching(identifier: "notificationBadge").allElementsBoundByIndex
|
||||
let itemsWithNotifications = MockSpaceSelectorService.defaultSpaceList.filter { $0.notificationCount > 0 }
|
||||
let itemsWithNotifications = MockSpaceSelectorService.defaultSpaceList.filter { $0.notificationCount > 0 || !$0.isJoined }
|
||||
XCTAssertEqual(notificationBadges.count, itemsWithNotifications.count)
|
||||
for (index, notificationBadge) in notificationBadges.enumerated() {
|
||||
XCTAssertEqual("\(itemsWithNotifications[index].notificationCount)", notificationBadge.label)
|
||||
let item = itemsWithNotifications[index]
|
||||
if item.isJoined {
|
||||
XCTAssertEqual("\(item.notificationCount)", notificationBadge.label)
|
||||
} else {
|
||||
XCTAssertEqual("! ", notificationBadge.label)
|
||||
}
|
||||
}
|
||||
|
||||
let spaceItemNameList = app.staticTexts.matching(identifier: "itemName").allElementsBoundByIndex
|
||||
|
|
Loading…
Reference in a new issue