react-native-navigation的迁移库

RNNTabBarPresenterTest.m 2.4KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859
  1. #import <XCTest/XCTest.h>
  2. #import <OCMock/OCMock.h>
  3. #import "RNNTabBarPresenter.h"
  4. #import "UITabBarController+RNNOptions.h"
  5. #import "RNNTabBarController.h"
  6. @interface RNNTabBarPresenterTest : XCTestCase
  7. @property (nonatomic, strong) RNNTabBarPresenter *uut;
  8. @property (nonatomic, strong) RNNNavigationOptions *options;
  9. @property (nonatomic, strong) id bindedViewController;
  10. @end
  11. @implementation RNNTabBarPresenterTest
  12. - (void)setUp {
  13. [super setUp];
  14. self.uut = [[RNNTabBarPresenter alloc] init];
  15. self.bindedViewController = [OCMockObject partialMockForObject:[RNNTabBarController new]];
  16. [self.uut bindViewController:self.bindedViewController];
  17. self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  18. }
  19. - (void)testApplyOptions_shouldSetDefaultEmptyOptions {
  20. RNNNavigationOptions* emptyOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
  21. [[self.bindedViewController expect] rnn_setTabBarTestID:nil];
  22. [[self.bindedViewController expect] rnn_setTabBarBackgroundColor:nil];
  23. [[self.bindedViewController expect] rnn_setTabBarTranslucent:NO];
  24. [[self.bindedViewController expect] rnn_setTabBarHideShadow:NO];
  25. [[self.bindedViewController expect] rnn_setTabBarStyle:UIBarStyleDefault];
  26. [[self.bindedViewController expect] rnn_setTabBarVisible:YES animated:NO];
  27. [self.uut applyOptions:emptyOptions];
  28. [self.bindedViewController verify];
  29. }
  30. - (void)testApplyOptions_shouldApplyOptions {
  31. RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initEmptyOptions];
  32. initialOptions.bottomTabs.testID = [[Text alloc] initWithValue:@"testID"];
  33. initialOptions.bottomTabs.backgroundColor = [[Color alloc] initWithValue:[UIColor redColor]];
  34. initialOptions.bottomTabs.translucent = [[Bool alloc] initWithValue:@(0)];
  35. initialOptions.bottomTabs.hideShadow = [[Bool alloc] initWithValue:@(1)];
  36. initialOptions.bottomTabs.visible = [[Bool alloc] initWithValue:@(0)];
  37. initialOptions.bottomTabs.barStyle = [[Text alloc] initWithValue:@"black"];
  38. [[self.bindedViewController expect] rnn_setTabBarTestID:@"testID"];
  39. [[self.bindedViewController expect] rnn_setTabBarBackgroundColor:[UIColor redColor]];
  40. [[self.bindedViewController expect] rnn_setTabBarTranslucent:NO];
  41. [[self.bindedViewController expect] rnn_setTabBarHideShadow:YES];
  42. [[self.bindedViewController expect] rnn_setTabBarStyle:UIBarStyleBlack];
  43. [[self.bindedViewController expect] rnn_setTabBarVisible:NO animated:NO];
  44. [self.uut applyOptions:initialOptions];
  45. [self.bindedViewController verify];
  46. }
  47. @end