forked from wix/react-native-navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRNNNavigationControllerPresenterTest.m
60 lines (46 loc) · 2.2 KB
/
RNNNavigationControllerPresenterTest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
#import <XCTest/XCTest.h>
#import <OCMock/OCMock.h>
#import "RNNNavigationControllerPresenter.h"
#import "UINavigationController+RNNOptions.h"
#import "RNNNavigationController.h"
@interface RNNNavigationControllerPresenterTest : XCTestCase
@property (nonatomic, strong) RNNNavigationControllerPresenter *uut;
@property (nonatomic, strong) RNNNavigationOptions *options;
@property (nonatomic, strong) id bindedViewController;
@end
@implementation RNNNavigationControllerPresenterTest
- (void)setUp {
[super setUp];
self.uut = [[RNNNavigationControllerPresenter alloc] init];
self.bindedViewController = [OCMockObject partialMockForObject:[RNNNavigationController new]];
[self.uut bindViewController:self.bindedViewController];
self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
}
- (void)testApplyOptions_shouldSetBackButtonColor_withDefaultValues {
[[_bindedViewController expect] rnn_setBackButtonColor:nil];
[self.uut applyOptions:self.options];
[_bindedViewController verify];
}
- (void)testApplyOptions_shouldSetBackButtonColor_withColor {
self.options.topBar.backButton.color = [[Color alloc] initWithValue:[UIColor redColor]];
[[_bindedViewController expect] rnn_setBackButtonColor:[UIColor redColor]];
[self.uut applyOptions:self.options];
[_bindedViewController verify];
}
- (void)testApplyOptionsBeforePoppingShouldSetTopBarBackgroundForPoppingViewController {
_options.topBar.background.color = [[Color alloc] initWithValue:[UIColor redColor]];
[[_bindedViewController expect] setTopBarBackgroundColor:_options.topBar.background.color.get];
[self.uut applyOptionsBeforePopping:self.options];
[_bindedViewController verify];
}
- (void)testApplyOptionsBeforePoppingShouldSetLargeTitleForPoppingViewController {
_options.topBar.largeTitle.visible = [[Bool alloc] initWithBOOL:YES];
[self.uut applyOptionsBeforePopping:self.options];
XCTAssertTrue([[self.uut.bindedViewController navigationBar] prefersLargeTitles]);
}
- (void)testApplyOptionsBeforePoppingShouldSetDefaultLargeTitleFalseForPoppingViewController {
_options.topBar.largeTitle.visible = nil;
[self.uut applyOptionsBeforePopping:self.options];
XCTAssertFalse([[self.uut.bindedViewController navigationBar] prefersLargeTitles]);
}
@end