Skip to content

Commit ca55c86

Browse files
committed
test updates to aline with iOS 18
1 parent 4942b3c commit ca55c86

File tree

4 files changed

+26
-11
lines changed

4 files changed

+26
-11
lines changed

playground/ios/NavigationTests/BottomTabsControllerTest.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,11 @@ - (void)testInitWithLayoutInfo_shouldCreateWithDefaultStyles {
104104
eventEmitter:nil
105105
childViewControllers:nil];
106106

107-
XCTAssertEqual(uut.modalPresentationStyle, UIModalPresentationPageSheet);
107+
if (@available(iOS 18.0, *)) {
108+
XCTAssertEqual(uut.modalPresentationStyle, UIModalPresentationFormSheet);
109+
} else {
110+
XCTAssertEqual(uut.modalPresentationStyle, UIModalPresentationPageSheet);
111+
}
108112
XCTAssertEqual(uut.modalTransitionStyle, UIModalTransitionStyleCoverVertical);
109113
}
110114

playground/ios/NavigationTests/RNNModalManagerTest.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,11 @@ - (void)testPresentationControllerDidDismiss_ShouldInvokeDelegateDismissedModalW
172172
- (void)testApplyOptionsOnInit_shouldShowModalWithDefaultPresentationStyle {
173173
_vc1.options = [RNNNavigationOptions emptyOptions];
174174
[_modalManager showModal:_vc1 animated:NO completion:nil];
175-
XCTAssertEqual(_vc1.modalPresentationStyle, UIModalPresentationPageSheet);
175+
if (@available(iOS 18.0, *)) {
176+
XCTAssertEqual(_vc1.modalPresentationStyle, UIModalPresentationFormSheet);
177+
} else {
178+
XCTAssertEqual(_vc1.modalPresentationStyle, UIModalPresentationPageSheet);
179+
}
176180
}
177181

178182
- (void)testApplyOptionsOnInit_shouldShowModalWithDefaultTransitionStyle {

playground/ios/NavigationTests/RNNStackControllerTest.mm

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -233,16 +233,19 @@ - (void)testMergeChildOptionsShouldNotUpdatePresenterForInvisibleChild {
233233
}
234234

235235
- (void)testOnChildWillAppear_shouldSetBackButtonTestID {
236-
RNNNavigationOptions *options = [RNNNavigationOptions emptyOptions];
237-
options.topBar.backButton.testID = [Text withValue:@"TestID"];
238-
RNNComponentViewController *pushedController =
239-
[RNNComponentViewController createWithComponentId:@"pushedController"];
240-
pushedController.options.topBar.backButton.testID = [Text withValue:@"TestID"];
236+
RNNComponentViewController *pushedController =
237+
[RNNComponentViewController createWithComponentId:@"pushedController"];
238+
pushedController.options.topBar.backButton.testID = [Text withValue:@"TestID"];
241239
UIApplication.sharedApplication.keyWindow.rootViewController = _uut;
242240
[_uut pushViewController:pushedController animated:NO];
243-
[pushedController viewDidAppear:YES];
244-
XCTAssertTrue([[[_uut.navigationBar.subviews[1] subviews][0]
245-
valueForKey:@"accessibilityIdentifier"] isEqualToString:@"TestID"]);
241+
[pushedController viewDidAppear:YES];
242+
dispatch_async(dispatch_get_main_queue(), ^{
243+
UIView *navigationBarContentView = [self->_uut.navigationBar findChildByClass:NSClassFromString(@"_UINavigationBarContentView")];
244+
XCTAssertNotNil(navigationBarContentView);
245+
UIView *barButton = [navigationBarContentView findChildByClass:NSClassFromString(@"_UIButtonBarButton")];
246+
XCTAssertNotNil(barButton);
247+
XCTAssertTrue([barButton.accessibilityIdentifier isEqualToString:@"TestID"]);
248+
});
246249
}
247250

248251
- (RNNStackController *)createNavigationControllerWithOptions:(RNNNavigationOptions *)options {

playground/ios/NavigationTests/UIViewController+LayoutProtocolTest.mm

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,11 @@ - (void)testInitWithLayoutApplyDefaultOptions {
3737
presenter:presenter
3838
eventEmitter:nil
3939
childViewControllers:nil];
40-
XCTAssertEqual(uut.modalPresentationStyle, UIModalPresentationPageSheet);
40+
if (@available(iOS 18.0, *)) {
41+
XCTAssertEqual(uut.modalPresentationStyle, UIModalPresentationFormSheet);
42+
} else {
43+
XCTAssertEqual(uut.modalPresentationStyle, UIModalPresentationPageSheet);
44+
}
4145
}
4246

4347
- (void)testInitWithLayoutInfoShouldSetChildViewControllers {

0 commit comments

Comments
 (0)