Skip to content

Commit

Permalink
test that the modally navigation controller pops with animation
Browse files Browse the repository at this point in the history
  • Loading branch information
dazy1030 committed Aug 27, 2024
1 parent d0fbb01 commit 34c1dc4
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions Examples/CaseStudiesTests/PresentationTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,38 @@ final class PresentationTests: XCTestCase {
await assertEventuallyEqual(nav.viewControllers.count, 1)
await assertEventuallyNil(nav.presentedViewController)
}

@MainActor func testAnimatedPopFromModallyNavigationController() async throws {
class VC: ViewController {
@UIBinding var presentedChild: Model?
override func viewDidLoad() {
super.viewDidLoad()
present(item: $presentedChild) { model in
let root = BasicViewController(model: model)
return UINavigationController(rootViewController: root)
}
}
}
let vc = VC()
try await setUp(controller: vc)

withUITransaction(\.uiKit.disablesAnimations, true) {
vc.presentedChild = Model()
}
try await Task.sleep(for: .seconds(0.5))

withUITransaction(\.uiKit.disablesAnimations, true) {
vc.presentedChild?.isPushed = true
}
try await Task.sleep(for: .seconds(0.5))

withUITransaction(\.uiKit.disablesAnimations, false) {
vc.presentedChild?.isPushed = false
}
try await Task.sleep(for: .seconds(1))

await assertEventuallyNotNil(vc.presentedChild)
}
}

@Observable
Expand Down

0 comments on commit 34c1dc4

Please sign in to comment.