Skip to content

Commit aa5da14

Browse files
authored
Merge pull request #63 from hotwired/path-config-underscores
Path config underscores
2 parents 22dd671 + 4922ac4 commit aa5da14

File tree

4 files changed

+15
-20
lines changed

4 files changed

+15
-20
lines changed

Source/Turbo/Navigator/Helpers/Navigation.swift

+2-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public enum Navigation {
1818
case medium
1919
case large
2020
case full
21-
case pageSheet
22-
case formSheet
21+
case pageSheet = "page_sheet"
22+
case formSheet = "form_sheet"
2323
}
2424
}

Tests/Hotwire/HotwireTests.swift

-12
This file was deleted.

Tests/Turbo/Fixtures/test-modal-styles-configuration.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
],
4545
"properties":{
4646
"context":"modal",
47-
"modal_style":"pageSheet"
47+
"modal_style":"page_sheet"
4848
}
4949
},
5050
{
@@ -53,7 +53,7 @@
5353
],
5454
"properties":{
5555
"context":"modal",
56-
"modal_style":"formSheet"
56+
"modal_style":"form_sheet"
5757
}
5858
}
5959
]

Tests/Turbo/Navigator/NavigationHierarchyControllerTests.swift

+11-4
Original file line numberDiff line numberDiff line change
@@ -327,7 +327,7 @@ final class NavigationHierarchyControllerTests: XCTestCase {
327327
path: "/new",
328328
context: .modal,
329329
additionalProperties: [
330-
"modal_style": "formSheet"
330+
"modal_style": "form_sheet"
331331
])
332332
navigator.route(proposal)
333333
XCTAssertEqual(modalNavigationController.modalPresentationStyle, .formSheet)
@@ -339,9 +339,16 @@ final class NavigationHierarchyControllerTests: XCTestCase {
339339
context: .modal
340340
)
341341
navigator.route(proposal)
342-
// NOTE: For most view controllers, UIKit maps `automatic` style to the UIModalPresentationStyle.pageSheet style,
343-
// but some system view controllers may map it to a different style.
344-
XCTAssertEqual(modalNavigationController.modalPresentationStyle, .pageSheet)
342+
// For most view controllers, UIKit maps [automatic] to:
343+
// UIModalPresentationStyle.formSheet in iOS 18 and later
344+
// UIModalPresentationStyle.pageSheet in versions of iOS earlier than iOS 18
345+
// Some system view controllers may map it to a different style.
346+
// https://developer.apple.com/documentation/uikit/uimodalpresentationstyle/automatic
347+
if #available(iOS 18, *) {
348+
XCTAssertEqual(modalNavigationController.modalPresentationStyle, .formSheet)
349+
} else {
350+
XCTAssertEqual(modalNavigationController.modalPresentationStyle, .pageSheet)
351+
}
345352
}
346353

347354
func test_modalDismissGestureEnabled_isCorrectlySet() throws {

0 commit comments

Comments
 (0)