From b14e34788b9e460506962e677434911fb2b72019 Mon Sep 17 00:00:00 2001 From: Joe Masilotti Date: Tue, 17 Dec 2024 14:23:38 -0800 Subject: [PATCH] Fix tests for iOS 18+ --- .../NavigationHierarchyControllerTests.swift | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift b/Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift index c88e015..4d4210a 100644 --- a/Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift +++ b/Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift @@ -339,9 +339,16 @@ final class NavigationHierarchyControllerTests: XCTestCase { context: .modal ) navigator.route(proposal) - // NOTE: For most view controllers, UIKit maps `automatic` style to the UIModalPresentationStyle.pageSheet style, - // but some system view controllers may map it to a different style. - XCTAssertEqual(modalNavigationController.modalPresentationStyle, .pageSheet) + // For most view controllers, UIKit maps [automatic] to: + // UIModalPresentationStyle.formSheet in iOS 18 and later + // UIModalPresentationStyle.pageSheet in versions of iOS earlier than iOS 18 + // Some system view controllers may map it to a different style. + // https://developer.apple.com/documentation/uikit/uimodalpresentationstyle/automatic + if #available(iOS 18, *) { + XCTAssertEqual(modalNavigationController.modalPresentationStyle, .formSheet) + } else { + XCTAssertEqual(modalNavigationController.modalPresentationStyle, .pageSheet) + } } func test_modalDismissGestureEnabled_isCorrectlySet() throws {