Skip to content

Commit

Permalink
Merge pull request #63 from hotwired/path-config-underscores
Browse files Browse the repository at this point in the history
Path config underscores
  • Loading branch information
jayohms authored Dec 18, 2024
2 parents 22dd671 + 4922ac4 commit aa5da14
Show file tree
Hide file tree
Showing 4 changed files with 15 additions and 20 deletions.
4 changes: 2 additions & 2 deletions Source/Turbo/Navigator/Helpers/Navigation.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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"
}
}
12 changes: 0 additions & 12 deletions Tests/Hotwire/HotwireTests.swift

This file was deleted.

4 changes: 2 additions & 2 deletions Tests/Turbo/Fixtures/test-modal-styles-configuration.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
],
"properties":{
"context":"modal",
"modal_style":"pageSheet"
"modal_style":"page_sheet"
}
},
{
Expand All @@ -53,7 +53,7 @@
],
"properties":{
"context":"modal",
"modal_style":"formSheet"
"modal_style":"form_sheet"
}
}
]
Expand Down
15 changes: 11 additions & 4 deletions Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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 {
Expand Down

0 comments on commit aa5da14

Please sign in to comment.