123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566 |
- #import <XCTest/XCTest.h>
- #import <OCMock/OCMock.h>
- #import "RNNTabBarPresenter.h"
- #import "UITabBarController+RNNOptions.h"
-
- @interface RNNTabBarPresenterTest : XCTestCase
-
- @property (nonatomic, strong) RNNTabBarPresenter *uut;
- @property (nonatomic, strong) RNNNavigationOptions *options;
- @property (nonatomic, strong) id bindedViewController;
-
- @end
-
- @implementation RNNTabBarPresenterTest
-
- - (void)setUp {
- [super setUp];
- self.uut = [[RNNTabBarPresenter alloc] init];
- self.bindedViewController = [OCMockObject partialMockForObject:[UITabBarController new]];
- [self.uut bindViewController:self.bindedViewController];
- self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
- }
-
- - (void)testApplyOptions_shouldSetDefaultEmptyOptions {
- RNNNavigationOptions* emptyOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
- [[self.bindedViewController expect] rnn_setTabBarTestID:nil];
- [[self.bindedViewController expect] rnn_setTabBarBackgroundColor:nil];
- [[self.bindedViewController expect] rnn_setTabBarTranslucent:NO];
- [[self.bindedViewController expect] rnn_setTabBarHideShadow:NO];
- [[self.bindedViewController expect] rnn_setTabBarStyle:UIBarStyleDefault];
- [[self.bindedViewController expect] rnn_setTabBarVisible:YES];
- [self.uut applyOptions:emptyOptions];
- [self.bindedViewController verify];
- }
-
- - (void)testApplyOptions_shouldApplyOptions {
- RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
- initialOptions.bottomTabs.testID = [[Text alloc] initWithValue:@"testID"];
- initialOptions.bottomTabs.backgroundColor = [[Color alloc] initWithValue:[UIColor redColor]];
- initialOptions.bottomTabs.translucent = [[Bool alloc] initWithValue:@(0)];
- initialOptions.bottomTabs.hideShadow = [[Bool alloc] initWithValue:@(1)];
- initialOptions.bottomTabs.visible = [[Bool alloc] initWithValue:@(0)];
- initialOptions.bottomTabs.barStyle = [[Text alloc] initWithValue:@"black"];
-
- [[self.bindedViewController expect] rnn_setTabBarTestID:@"testID"];
- [[self.bindedViewController expect] rnn_setTabBarBackgroundColor:[UIColor redColor]];
- [[self.bindedViewController expect] rnn_setTabBarTranslucent:NO];
- [[self.bindedViewController expect] rnn_setTabBarHideShadow:YES];
- [[self.bindedViewController expect] rnn_setTabBarStyle:UIBarStyleBlack];
- [[self.bindedViewController expect] rnn_setTabBarVisible:NO];
-
- [self.uut applyOptions:initialOptions];
- [self.bindedViewController verify];
- }
-
- - (void)testApplyOptions_shouldApplyOptionsOnInit {
- RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
- initialOptions.bottomTabs.currentTabIndex = [[IntNumber alloc] initWithValue:@(1)];
- [[self.bindedViewController expect] rnn_setCurrentTabIndex:1];
-
- [self.uut applyOptionsOnInit:initialOptions];
- [self.bindedViewController verify];
- }
-
- @end
|