diff --git a/Source/Turbo/Navigator/Helpers/Navigation.swift b/Source/Turbo/Navigator/Helpers/Navigation.swift index c911fa6..599013c 100644 --- a/Source/Turbo/Navigator/Helpers/Navigation.swift +++ b/Source/Turbo/Navigator/Helpers/Navigation.swift @@ -18,7 +18,7 @@ public enum Navigation { case medium case large case full - case pageSheet - case formSheet + case pageSheet = "page_sheet" + case formSheet = "form_sheet" } } diff --git a/Tests/Hotwire/HotwireTests.swift b/Tests/Hotwire/HotwireTests.swift deleted file mode 100644 index 0be57c3..0000000 --- a/Tests/Hotwire/HotwireTests.swift +++ /dev/null @@ -1,12 +0,0 @@ -@testable import HotwireNative -import XCTest - -final class HotwireTests: XCTestCase { - func testExample() throws { - // XCTest Documentation - // https://developer.apple.com/documentation/xctest - - // Defining Test Cases and Test Methods - // https://developer.apple.com/documentation/xctest/defining_test_cases_and_test_methods - } -} diff --git a/Tests/Turbo/Fixtures/test-modal-styles-configuration.json b/Tests/Turbo/Fixtures/test-modal-styles-configuration.json index 06e8f96..e729aad 100644 --- a/Tests/Turbo/Fixtures/test-modal-styles-configuration.json +++ b/Tests/Turbo/Fixtures/test-modal-styles-configuration.json @@ -44,7 +44,7 @@ ], "properties":{ "context":"modal", - "modal_style":"pageSheet" + "modal_style":"page_sheet" } }, { @@ -53,7 +53,7 @@ ], "properties":{ "context":"modal", - "modal_style":"formSheet" + "modal_style":"form_sheet" } } ] diff --git a/Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift b/Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift index c88e015..8ede16a 100644 --- a/Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift +++ b/Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift @@ -327,7 +327,7 @@ final class NavigationHierarchyControllerTests: XCTestCase { path: "/new", context: .modal, additionalProperties: [ - "modal_style": "formSheet" + "modal_style": "form_sheet" ]) navigator.route(proposal) XCTAssertEqual(modalNavigationController.modalPresentationStyle, .formSheet) @@ -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 {