@@ -521,6 +521,40 @@ - (void)testSetRoot_withBottomTabsAttachModeOnSwitchToTab {
521
521
XCTAssertTrue (_vc2.isViewLoaded );
522
522
}
523
523
524
+ - (void )testSetRoot_withBottomTabsAttachModeOnSwitchToTabWithCustomIndex {
525
+ [self .uut setReadyToReceiveCommands: true ];
526
+ RNNNavigationOptions *options = [RNNNavigationOptions emptyOptions ];
527
+ options.bottomTabs .tabsAttachMode =
528
+ [[BottomTabsAttachMode alloc ] initWithValue: @" onSwitchToTab" ];
529
+ options.animations .setRoot .waitForRender = [[Bool alloc ] initWithBOOL: YES ];
530
+ options.bottomTabs .currentTabIndex = [IntNumber withValue: @1 ];
531
+
532
+ BottomTabsBaseAttacher *attacher =
533
+ [[[BottomTabsAttachModeFactory alloc ] initWithDefaultOptions: nil ] fromOptions: options];
534
+ RNNBottomTabsController *tabBarController =
535
+ [[RNNBottomTabsController alloc ] initWithLayoutInfo: nil
536
+ creator: nil
537
+ options: options
538
+ defaultOptions: [RNNNavigationOptions emptyOptions ]
539
+ presenter: [RNNBasePresenter new ]
540
+ bottomTabPresenter: nil
541
+ dotIndicatorPresenter: nil
542
+ eventEmitter: _eventEmmiter
543
+ childViewControllers: @[ _vc1, _vc2 ]
544
+ bottomTabsAttacher: attacher];
545
+ [tabBarController viewWillAppear: YES ];
546
+ OCMStub ([self .controllerFactory createLayout: [OCMArg any ]]).andReturn (tabBarController);
547
+
548
+ [self .uut setRoot: @{}
549
+ commandId: @" "
550
+ completion: ^(NSString *componentId){
551
+ }];
552
+ XCTAssertFalse (_vc1.isViewLoaded );
553
+ XCTAssertTrue (_vc2.isViewLoaded );
554
+ [tabBarController setSelectedIndex: 0 ];
555
+ XCTAssertTrue (_vc1.isViewLoaded );
556
+ }
557
+
524
558
- (void )testSetRoot_withBottomTabsAttachModeAfterInitialTab {
525
559
[self .uut setReadyToReceiveCommands: true ];
526
560
RNNNavigationOptions *options = [RNNNavigationOptions emptyOptions ];
0 commit comments