react-native-navigation的迁移库

RNNSideMenuPresenterTest.m 2.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #import <XCTest/XCTest.h>
  2. #import <OCMock/OCMock.h>
  3. #import "RNNSideMenuPresenter.h"
  4. #import "RNNSideMenuController.h"
  5. @interface RNNSideMenuPresenterTest : XCTestCase
  6. @property (nonatomic, strong) RNNSideMenuPresenter *uut;
  7. @property (nonatomic, strong) RNNNavigationOptions *options;
  8. @property (nonatomic, strong) id bindedViewController;
  9. @end
  10. @implementation RNNSideMenuPresenterTest
  11. - (void)setUp {
  12. [super setUp];
  13. self.uut = [[RNNSideMenuPresenter alloc] init];
  14. self.bindedViewController = [OCMockObject partialMockForObject:[RNNSideMenuController new]];
  15. [self.uut bindViewController:self.bindedViewController];
  16. self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  17. }
  18. - (void)testApplyOptionsShouldSetDefaultValues {
  19. [[self.bindedViewController expect] side:MMDrawerSideLeft enabled:YES];
  20. [[self.bindedViewController expect] side:MMDrawerSideRight enabled:YES];
  21. [[self.bindedViewController expect] setShouldStretchLeftDrawer:YES];
  22. [[self.bindedViewController expect] setShouldStretchRightDrawer:YES];
  23. [[self.bindedViewController expect] setAnimationVelocityLeft:840.0f];
  24. [[self.bindedViewController expect] setAnimationVelocityRight:840.0f];
  25. [[self.bindedViewController reject] side:MMDrawerSideLeft width:0];
  26. [[self.bindedViewController reject] side:MMDrawerSideRight width:0];
  27. [self.uut applyOptions:self.options];
  28. [self.bindedViewController verify];
  29. }
  30. - (void)testApplyOptionsShouldSetInitialValues {
  31. self.options.sideMenu.left.enabled = [[Bool alloc] initWithBOOL:NO];
  32. self.options.sideMenu.right.enabled = [[Bool alloc] initWithBOOL:NO];
  33. self.options.sideMenu.left.shouldStretchDrawer = [[Bool alloc] initWithBOOL:NO];
  34. self.options.sideMenu.right.shouldStretchDrawer = [[Bool alloc] initWithBOOL:NO];
  35. self.options.sideMenu.right.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
  36. self.options.sideMenu.left.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
  37. self.options.sideMenu.right.width = [[Double alloc] initWithValue:@(100.0f)];
  38. self.options.sideMenu.left.width = [[Double alloc] initWithValue:@(100.0f)];
  39. [[self.bindedViewController expect] side:MMDrawerSideLeft enabled:NO];
  40. [[self.bindedViewController expect] side:MMDrawerSideRight enabled:NO];
  41. [[self.bindedViewController expect] setShouldStretchLeftDrawer:NO];
  42. [[self.bindedViewController expect] setShouldStretchRightDrawer:NO];
  43. [[self.bindedViewController expect] setAnimationVelocityLeft:100.0f];
  44. [[self.bindedViewController expect] setAnimationVelocityRight:100.0f];
  45. [[self.bindedViewController expect] side:MMDrawerSideLeft width:100.0f];
  46. [[self.bindedViewController expect] side:MMDrawerSideRight width:100.0f];
  47. [self.uut applyOptions:self.options];
  48. [self.bindedViewController verify];
  49. }
  50. @end