|
@@ -26,8 +26,7 @@
|
26
|
26
|
self.mockTabBarPresenter = [OCMockObject partialMockForObject:[[RNNTabBarPresenter alloc] init]];
|
27
|
27
|
self.mockChildViewController = [OCMockObject partialMockForObject:[RNNRootViewController new]];
|
28
|
28
|
self.mockEventEmmiter = [OCMockObject partialMockForObject:[RNNEventEmitter new]];
|
29
|
|
- self.mockUut = [OCMockObject partialMockForObject:[[RNNTabBarController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:self.mockTabBarPresenter eventEmitter:self.mockEventEmmiter]];
|
30
|
|
- [self.mockUut setViewControllers:@[[[UIViewController alloc] init]]];
|
|
29
|
+ self.mockUut = [OCMockObject partialMockForObject:[[RNNTabBarController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:self.mockTabBarPresenter eventEmitter:self.mockEventEmmiter childViewControllers:@[[[UIViewController alloc] init]]]];
|
31
|
30
|
OCMStub([self.mockUut selectedViewController]).andReturn(self.mockChildViewController);
|
32
|
31
|
}
|
33
|
32
|
|
|
@@ -39,8 +38,7 @@
|
39
|
38
|
UIViewController* vc1 = [[UIViewController alloc] init];
|
40
|
39
|
UIViewController* vc2 = [[UIViewController alloc] init];
|
41
|
40
|
|
42
|
|
- RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNViewControllerPresenter alloc] init] eventEmitter:nil];
|
43
|
|
- [uut setViewControllers:@[vc1, vc2]];
|
|
41
|
+ RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNViewControllerPresenter alloc] init] eventEmitter:nil childViewControllers:@[vc1, vc2]];
|
44
|
42
|
XCTAssertTrue(uut.viewControllers.count == 2);
|
45
|
43
|
}
|
46
|
44
|
|
|
@@ -50,8 +48,7 @@
|
50
|
48
|
RNNTabBarPresenter* presenter = [[RNNTabBarPresenter alloc] init];
|
51
|
49
|
NSArray* childViewControllers = @[[UIViewController new]];
|
52
|
50
|
|
53
|
|
- RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo creator:nil options:options defaultOptions:nil presenter:presenter eventEmitter:nil];
|
54
|
|
- [uut setViewControllers:childViewControllers];
|
|
51
|
+ RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo creator:nil options:options defaultOptions:nil presenter:presenter eventEmitter:nil childViewControllers:childViewControllers];
|
55
|
52
|
XCTAssertTrue(uut.layoutInfo == layoutInfo);
|
56
|
53
|
XCTAssertTrue(uut.options == options);
|
57
|
54
|
XCTAssertTrue(uut.presenter == presenter);
|
|
@@ -66,8 +63,7 @@
|
66
|
63
|
|
67
|
64
|
NSArray* childViewControllers = @[[UIViewController new]];
|
68
|
65
|
|
69
|
|
- RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo creator:nil options:options defaultOptions:nil presenter:presenter eventEmitter:eventEmmiter];
|
70
|
|
- [uut setViewControllers:childViewControllers];
|
|
66
|
+ RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:layoutInfo creator:nil options:options defaultOptions:nil presenter:presenter eventEmitter:eventEmmiter childViewControllers:childViewControllers];
|
71
|
67
|
XCTAssertTrue(uut.layoutInfo == layoutInfo);
|
72
|
68
|
XCTAssertTrue(uut.options == options);
|
73
|
69
|
XCTAssertTrue(uut.presenter == presenter);
|
|
@@ -76,7 +72,7 @@
|
76
|
72
|
}
|
77
|
73
|
|
78
|
74
|
- (void)testInitWithLayoutInfo_shouldSetDelegate {
|
79
|
|
- RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNBasePresenter alloc] init] eventEmitter:nil];
|
|
75
|
+ RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil creator:nil options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNBasePresenter alloc] init] eventEmitter:nil childViewControllers:nil];
|
80
|
76
|
|
81
|
77
|
XCTAssertTrue(uut.delegate == uut);
|
82
|
78
|
}
|
|
@@ -152,8 +148,7 @@
|
152
|
148
|
|
153
|
149
|
RNNRootViewController* vc = [[RNNRootViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:nil eventEmitter:nil presenter:nil options:nil defaultOptions:nil];
|
154
|
150
|
|
155
|
|
- RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil creator:nil options:nil defaultOptions:nil presenter:[RNNTabBarPresenter new] eventEmitter:nil];
|
156
|
|
- [uut setViewControllers:@[[UIViewController new], vc]];
|
|
151
|
+ RNNTabBarController* uut = [[RNNTabBarController alloc] initWithLayoutInfo:nil creator:nil options:nil defaultOptions:nil presenter:[RNNTabBarPresenter new] eventEmitter:nil childViewControllers:@[[UIViewController new], vc]];
|
157
|
152
|
[uut setSelectedIndexByComponentID:@"componentId"];
|
158
|
153
|
XCTAssertTrue(uut.selectedIndex == 1);
|
159
|
154
|
}
|