|
@@ -19,11 +19,11 @@
|
19
|
19
|
- (void)setUp {
|
20
|
20
|
[super setUp];
|
21
|
21
|
|
22
|
|
- _vc1 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[[RNNViewControllerPresenter alloc] init] options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions]];
|
|
22
|
+ _vc1 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[OCMockObject partialMockForObject:[[RNNViewControllerPresenter alloc] init]] options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions]];
|
23
|
23
|
_vc2 = [[RNNRootViewController alloc] initWithLayoutInfo:nil rootViewCreator:nil eventEmitter:nil presenter:[[RNNViewControllerPresenter alloc] init] options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions]];
|
24
|
24
|
_vc3 = [UIViewController new];
|
25
|
|
- _options = [[RNNNavigationOptions alloc] initEmptyOptions];
|
26
|
|
- self.uut = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1, _vc2] options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil presenter:[[RNNViewControllerPresenter alloc] init]];
|
|
25
|
+ _options = [OCMockObject partialMockForObject:[[RNNNavigationOptions alloc] initEmptyOptions]];
|
|
26
|
+ self.uut = [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1, _vc2] options:_options defaultOptions:nil presenter:[OCMockObject partialMockForObject:[[RNNNavigationControllerPresenter alloc] init]]];
|
27
|
27
|
}
|
28
|
28
|
|
29
|
29
|
- (void)testInitWithLayoutInfo_shouldBindPresenter {
|
|
@@ -115,27 +115,38 @@
|
115
|
115
|
}
|
116
|
116
|
|
117
|
117
|
- (void)testPopViewControllerSetTopBarBackgroundForPoppingViewController {
|
118
|
|
- RNNNavigationController* uut = [RNNNavigationController new];
|
119
|
|
- [uut setViewControllers:@[_vc1, _vc2]];
|
120
|
|
-
|
121
|
118
|
_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
|
122
|
119
|
[_vc1 overrideOptions:_options];
|
123
|
120
|
|
124
|
|
- [uut popViewControllerAnimated:NO];
|
125
|
|
- XCTAssertEqual(_vc1.resolveOptions.topBar.background.color.get, uut.navigationBar.barTintColor);
|
|
121
|
+ [self.uut popViewControllerAnimated:NO];
|
|
122
|
+ XCTAssertEqual(_vc1.resolveOptions.topBar.background.color.get, self.uut.navigationBar.barTintColor);
|
126
|
123
|
}
|
127
|
124
|
|
128
|
125
|
- (void)testPopViewControllerSetDefaultTopBarBackgroundForPoppingViewController {
|
129
|
|
- RNNNavigationController* uut = [RNNNavigationController new];
|
130
|
|
- [uut setViewControllers:@[_vc1, _vc2]];
|
131
|
|
-
|
132
|
126
|
_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
|
133
|
127
|
[_vc1 setDefaultOptions:_options];
|
134
|
128
|
|
|
129
|
+ [self.uut popViewControllerAnimated:NO];
|
|
130
|
+ XCTAssertEqual(_vc1.resolveOptions.topBar.background.color.get, self.uut.navigationBar.barTintColor);
|
|
131
|
+}
|
|
132
|
+
|
|
133
|
+- (void)testPopViewControllerShouldInvokeApplyOptionsBeforePoppingForDestinationViewController {
|
|
134
|
+ RNNNavigationController* uut = [RNNNavigationController new];
|
|
135
|
+ [uut setViewControllers:@[_vc1, _vc2]];
|
|
136
|
+
|
|
137
|
+ [[(id)uut.presenter expect] applyOptionsBeforePopping:[OCMArg any]];
|
|
138
|
+
|
135
|
139
|
[uut popViewControllerAnimated:NO];
|
136
|
|
- XCTAssertEqual(_vc1.resolveOptions.topBar.background.color.get, uut.navigationBar.barTintColor);
|
|
140
|
+
|
|
141
|
+ [(id)uut.presenter verify];
|
137
|
142
|
}
|
138
|
143
|
|
|
144
|
+- (void)testOverrideOptionsShouldOverrideOptionsState {
|
|
145
|
+ RNNNavigationOptions* overrideOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
|
|
146
|
+ [(RNNNavigationOptions*)[(id)self.uut.options expect] overrideOptions:overrideOptions];
|
|
147
|
+ [self.uut overrideOptions:overrideOptions];
|
|
148
|
+ [(id)self.uut.options verify];
|
|
149
|
+}
|
139
|
150
|
|
140
|
151
|
- (RNNNavigationController *)createNavigationControllerWithOptions:(RNNNavigationOptions *)options {
|
141
|
152
|
return [[RNNNavigationController alloc] initWithLayoutInfo:nil childViewControllers:@[_vc1] options:options defaultOptions:nil presenter:[[RNNNavigationControllerPresenter alloc] init]];
|