mirror of
https://github.com/Novaloop-AG/element-x-ios.git
synced 2026-11-03 06:55:59 +00:00
Fix some app route navigation bugs. (#4415)
- Opening a notification would update the stack with an animated pop. - Opening a permalink from the timeline wouldn't push the room as a child.
This commit is contained in:
@@ -68,6 +68,32 @@ class UserSessionFlowCoordinatorTests: XCTestCase {
|
||||
XCTAssertNotNil(detailCoordinator)
|
||||
}
|
||||
|
||||
func testRoomPresentationClearsSettings() async throws {
|
||||
try await process(route: .settings, expectedUserSessionState: .settingsScreen)
|
||||
XCTAssertTrue((tabCoordinator?.sheetCoordinator as? NavigationStackCoordinator)?.rootCoordinator is SettingsScreenCoordinator)
|
||||
XCTAssertNil(detailCoordinator)
|
||||
|
||||
try await process(route: .room(roomID: "1", via: []), expectedChatsState: .roomList(roomListSelectedRoomID: "1"))
|
||||
XCTAssertNil((tabCoordinator?.sheetCoordinator))
|
||||
XCTAssertTrue(detailNavigationStack?.rootCoordinator is RoomScreenCoordinator)
|
||||
XCTAssertNotNil(detailCoordinator)
|
||||
}
|
||||
|
||||
func testChildRoomPresentation() async throws {
|
||||
try await process(route: .room(roomID: "1", via: []), expectedChatsState: .roomList(roomListSelectedRoomID: "1"))
|
||||
let detailNavigationStack = try XCTUnwrap(detailNavigationStack, "There must be a navigation stack.")
|
||||
XCTAssertTrue(detailNavigationStack.rootCoordinator is RoomScreenCoordinator)
|
||||
XCTAssertNotNil(detailCoordinator)
|
||||
|
||||
let deferred = deferFulfillment(detailNavigationStack.observe(\.stackCoordinators.count)) { $0 == 1 }
|
||||
try await process(route: .childRoom(roomID: "2", via: []))
|
||||
try await deferred.fulfill()
|
||||
XCTAssertTrue(detailNavigationStack.rootCoordinator is RoomScreenCoordinator)
|
||||
XCTAssertNotNil(detailCoordinator)
|
||||
XCTAssertEqual(detailNavigationStack.stackCoordinators.count, 1)
|
||||
XCTAssertTrue(detailNavigationStack.stackCoordinators.first is RoomScreenCoordinator)
|
||||
}
|
||||
|
||||
func testShareMediaRouteWithoutRoom() async throws {
|
||||
try await process(route: .settings, expectedUserSessionState: .settingsScreen)
|
||||
XCTAssertTrue((tabCoordinator?.sheetCoordinator as? NavigationStackCoordinator)?.rootCoordinator is SettingsScreenCoordinator)
|
||||
|
||||
Reference in New Issue
Block a user