react-native-navigation的迁移库

RNNCommandsHandlerTest.m 19KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440
  1. #import <XCTest/XCTest.h>
  2. #import <objc/runtime.h>
  3. #import <ReactNativeNavigation/RNNCommandsHandler.h>
  4. #import <ReactNativeNavigation/RNNNavigationOptions.h>
  5. #import "RNNTestRootViewCreator.h"
  6. #import <ReactNativeNavigation/RNNComponentViewController.h>
  7. #import <ReactNativeNavigation/RNNStackController.h>
  8. #import <ReactNativeNavigation/RNNErrorHandler.h>
  9. #import <OCMock/OCMock.h>
  10. #import "RNNLayoutManager.h"
  11. #import "RNNBottomTabsController.h"
  12. #import "BottomTabsAttachModeFactory.h"
  13. @interface MockUIApplication : NSObject
  14. -(UIWindow *)keyWindow;
  15. @end
  16. @implementation MockUIApplication
  17. - (UIWindow *)keyWindow {
  18. return [UIWindow new];
  19. }
  20. @end
  21. @interface MockUINavigationController : RNNStackController
  22. @property (nonatomic, strong) NSArray* willReturnVCs;
  23. @end
  24. @implementation MockUINavigationController
  25. -(NSArray<UIViewController *> *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated {
  26. return self.willReturnVCs;
  27. }
  28. -(NSArray<UIViewController *> *)popToRootViewControllerAnimated:(BOOL)animated {
  29. return self.willReturnVCs;
  30. }
  31. @end
  32. @interface RNNCommandsHandlerTest : XCTestCase
  33. @property (nonatomic, strong) RNNCommandsHandler* uut;
  34. @property (nonatomic, strong) id modalManager;
  35. @property (nonatomic, strong) RNNComponentViewController* vc1;
  36. @property (nonatomic, strong) RNNComponentViewController* vc2;
  37. @property (nonatomic, strong) RNNComponentViewController* vc3;
  38. @property (nonatomic, strong) MockUINavigationController* nvc;
  39. @property (nonatomic, strong) id mainWindow;
  40. @property (nonatomic, strong) id sharedApplication;
  41. @property (nonatomic, strong) id controllerFactory;
  42. @property (nonatomic, strong) id overlayManager;
  43. @property (nonatomic, strong) id eventEmmiter;
  44. @property (nonatomic, strong) id creator;
  45. @end
  46. @implementation RNNCommandsHandlerTest
  47. - (void)setUp {
  48. [super setUp];
  49. self.sharedApplication = [OCMockObject mockForClass:[UIApplication class]];
  50. self.creator = [OCMockObject partialMockForObject:[RNNTestRootViewCreator new]];
  51. self.mainWindow = [OCMockObject partialMockForObject:[UIWindow new]];
  52. self.eventEmmiter = [OCMockObject partialMockForObject:[RNNEventEmitter new]];
  53. self.overlayManager = [OCMockObject partialMockForObject:[RNNOverlayManager new]];
  54. self.modalManager = [OCMockObject partialMockForObject:[RNNModalManager new]];
  55. self.controllerFactory = [OCMockObject partialMockForObject:[[RNNControllerFactory alloc] initWithRootViewCreator:nil eventEmitter:self.eventEmmiter store:nil componentRegistry:nil andBridge:nil bottomTabsAttachModeFactory:[BottomTabsAttachModeFactory new]]];
  56. self.uut = [[RNNCommandsHandler alloc] initWithControllerFactory:self.controllerFactory eventEmitter:self.eventEmmiter stackManager:[RNNNavigationStackManager new] modalManager:self.modalManager overlayManager:self.overlayManager mainWindow:_mainWindow];
  57. self.vc1 = [self generateComponentWithComponentId:@"1"];
  58. self.vc2 = [self generateComponentWithComponentId:@"2"];
  59. self.vc3 = [self generateComponentWithComponentId:@"3"];
  60. _nvc = [[MockUINavigationController alloc] init];
  61. [_nvc setViewControllers:@[self.vc1, self.vc2, self.vc3]];
  62. OCMStub([self.sharedApplication keyWindow]).andReturn(self.mainWindow);
  63. }
  64. - (RNNComponentViewController *)generateComponentWithComponentId:(NSString *)componentId {
  65. RNNLayoutInfo* layoutInfo = [[RNNLayoutInfo alloc] init];
  66. layoutInfo.componentId = componentId;
  67. return [[RNNComponentViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:_creator eventEmitter:nil presenter:[RNNComponentPresenter new] options:[[RNNNavigationOptions alloc] initWithDict:@{}] defaultOptions:nil];
  68. }
  69. - (void)testAssertReadyForEachMethodThrowsExceptions {
  70. NSArray* methods = [self getPublicMethodNamesForObject:self.uut];
  71. [self.uut setReadyToReceiveCommands:false];
  72. for (NSString* methodName in methods) {
  73. SEL s = NSSelectorFromString(methodName);
  74. IMP imp = [self.uut methodForSelector:s];
  75. void (*func)(id, SEL, id, id, id, id, id) = (void *)imp;
  76. XCTAssertThrowsSpecificNamed(func(self.uut,s, nil, nil, nil, nil, nil), NSException, @"BridgeNotLoadedError");
  77. }
  78. }
  79. - (NSArray*)getPublicMethodNamesForObject:(NSObject*)obj {
  80. NSMutableArray* skipMethods = [NSMutableArray new];
  81. [skipMethods addObject:@"initWithControllerFactory:eventEmitter:stackManager:modalManager:overlayManager:mainWindow:"];
  82. [skipMethods addObject:@"assertReady"];
  83. [skipMethods addObject:@"setReadyToReceiveCommands:"];
  84. [skipMethods addObject:@"readyToReceiveCommands"];
  85. [skipMethods addObject:@".cxx_destruct"];
  86. [skipMethods addObject:@"dismissedModal:"];
  87. [skipMethods addObject:@"attemptedToDismissModal:"];
  88. [skipMethods addObject:@"dismissedMultipleModals:"];
  89. NSMutableArray* result = [NSMutableArray new];
  90. // count and names:
  91. int i=0;
  92. unsigned int mc = 0;
  93. Method * mlist = class_copyMethodList(object_getClass(obj), &mc);
  94. for(i=0; i<mc; i++) {
  95. NSString *methodName = [NSString stringWithUTF8String:sel_getName(method_getName(mlist[i]))];
  96. // filter skippedMethods
  97. if (methodName && ![skipMethods containsObject:methodName]) {
  98. [result addObject:methodName];
  99. }
  100. }
  101. return result;
  102. }
  103. -(void)testDynamicStylesMergeWithStaticStyles {
  104. RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
  105. initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];
  106. RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
  107. RNNTestRootViewCreator* creator = [[RNNTestRootViewCreator alloc] init];
  108. RNNComponentPresenter* presenter = [[RNNComponentPresenter alloc] initWithComponentRegistry:nil defaultOptions:nil];
  109. RNNComponentViewController* vc = [[RNNComponentViewController alloc] initWithLayoutInfo:layoutInfo rootViewCreator:creator eventEmitter:nil presenter:presenter options:initialOptions defaultOptions:nil];
  110. RNNStackController* nav = [[RNNStackController alloc] initWithLayoutInfo:nil creator:creator options:[[RNNNavigationOptions alloc] initEmptyOptions] defaultOptions:nil presenter:[[RNNStackPresenter alloc] init] eventEmitter:nil childViewControllers:@[vc]];
  111. [vc viewWillAppear:false];
  112. XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
  113. [self.uut setReadyToReceiveCommands:true];
  114. NSDictionary* dictFromJs = @{@"topBar": @{@"background" : @{@"color" : @(0xFFFF0000)}}};
  115. UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
  116. [self.uut mergeOptions:@"componentId" options:dictFromJs completion:^{
  117. XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
  118. XCTAssertTrue([nav.navigationBar.barTintColor isEqual:expectedColor]);
  119. }];
  120. }
  121. - (void)testMergeOptions_shouldOverrideOptions {
  122. RNNNavigationOptions* initialOptions = [[RNNNavigationOptions alloc] initWithDict:@{}];
  123. initialOptions.topBar.title.text = [[Text alloc] initWithValue:@"the title"];
  124. RNNComponentPresenter* presenter = [[RNNComponentPresenter alloc] initWithComponentRegistry:nil defaultOptions:nil];
  125. RNNComponentViewController* vc = [[RNNComponentViewController alloc] initWithLayoutInfo:nil rootViewCreator:[[RNNTestRootViewCreator alloc] init] eventEmitter:nil presenter:presenter options:initialOptions defaultOptions:nil];
  126. __unused RNNStackController* nav = [[RNNStackController alloc] initWithRootViewController:vc];
  127. [vc viewWillAppear:false];
  128. XCTAssertTrue([vc.navigationItem.title isEqual:@"the title"]);
  129. [self.uut setReadyToReceiveCommands:true];
  130. NSDictionary* dictFromJs = @{@"topBar": @{@"title" : @{@"text" : @"new title"}}};
  131. [self.uut mergeOptions:@"componentId" options:dictFromJs completion:^{
  132. XCTAssertTrue([vc.navigationItem.title isEqual:@"new title"]);
  133. }];
  134. }
  135. - (void)testShowOverlay_createLayout {
  136. [self.uut setReadyToReceiveCommands:true];
  137. OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
  138. NSDictionary* layout = @{};
  139. [[self.controllerFactory expect] createLayout:layout];
  140. [self.uut showOverlay:layout commandId:@"" completion:^{}];
  141. [self.controllerFactory verify];
  142. }
  143. - (void)testShowOverlay_saveToStore {
  144. [self.uut setReadyToReceiveCommands:true];
  145. OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
  146. OCMStub([self.controllerFactory createLayout:[OCMArg any]]);
  147. [[self.controllerFactory expect] createLayout:[OCMArg any]];
  148. [self.uut showOverlay:@{} commandId:@"" completion:^{}];
  149. [self.overlayManager verify];
  150. }
  151. - (void)testShowOverlay_withCreatedLayout {
  152. [self.uut setReadyToReceiveCommands:true];
  153. UIViewController* layoutVC = [self generateComponentWithComponentId:nil];
  154. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(layoutVC);
  155. [[self.overlayManager expect] showOverlayWindow:[OCMArg any]];
  156. [self.uut showOverlay:@{} commandId:@"" completion:^{}];
  157. [self.overlayManager verify];
  158. }
  159. - (void)testShowOverlay_invokeNavigationCommandEventWithLayout {
  160. [self.uut setReadyToReceiveCommands:true];
  161. OCMStub([self.overlayManager showOverlayWindow:[OCMArg any]]);
  162. id mockedVC = [OCMockObject partialMockForObject:self.vc1];
  163. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);
  164. NSDictionary* layout = @{};
  165. [[self.eventEmmiter expect] sendOnNavigationCommandCompletion:@"showOverlay" commandId:[OCMArg any] params:[OCMArg any]];
  166. [self.uut showOverlay:layout commandId:@"" completion:^{}];
  167. [self.eventEmmiter verify];
  168. }
  169. - (void)testDismissOverlay_findComponentFromLayoutManager {
  170. [self.uut setReadyToReceiveCommands:true];
  171. NSString* componentId = @"componentId";
  172. id classMock = OCMClassMock([RNNLayoutManager class]);
  173. [[classMock expect] findComponentForId:componentId];
  174. [self.uut dismissOverlay:componentId commandId:@"" completion:^{} rejection:^(NSString *code, NSString *message, NSError *error) {}];
  175. [classMock verify];
  176. }
  177. - (void)testDismissOverlay_dismissReturnedViewController {
  178. [self.uut setReadyToReceiveCommands:true];
  179. NSString* componentId = @"componentId";
  180. UIViewController* returnedView = [UIViewController new];
  181. id classMock = OCMClassMock([RNNLayoutManager class]);
  182. OCMStub(ClassMethod([classMock findComponentForId:componentId])).andReturn(returnedView);
  183. [[self.overlayManager expect] dismissOverlay:returnedView];
  184. [self.uut dismissOverlay:componentId commandId:@"" completion:^{} rejection:^(NSString *code, NSString *message, NSError *error) {}];
  185. [self.overlayManager verify];
  186. }
  187. - (void)testDismissOverlay_handleErrorIfNoOverlayExists {
  188. [self.uut setReadyToReceiveCommands:true];
  189. NSString* componentId = @"componentId";
  190. id errorHandlerMockClass = [OCMockObject mockForClass:[RNNErrorHandler class]];
  191. [[errorHandlerMockClass expect] reject:[OCMArg any] withErrorCode:1010 errorDescription:[OCMArg any]];
  192. [self.uut dismissOverlay:componentId commandId:@"" completion:[OCMArg any] rejection:[OCMArg any]];
  193. [errorHandlerMockClass verify];
  194. }
  195. - (void)testDismissOverlay_invokeNavigationCommandEvent {
  196. [self.uut setReadyToReceiveCommands:true];
  197. NSString* componentId = @"componentId";
  198. id classMock = OCMClassMock([RNNLayoutManager class]);
  199. OCMStub(ClassMethod([classMock findComponentForId:componentId])).andReturn([UIViewController new]);
  200. [[self.eventEmmiter expect] sendOnNavigationCommandCompletion:@"dismissOverlay" commandId:[OCMArg any] params:[OCMArg any]];
  201. [self.uut dismissOverlay:componentId commandId:@"" completion:^{
  202. } rejection:^(NSString *code, NSString *message, NSError *error) {}];
  203. [self.eventEmmiter verify];
  204. }
  205. - (void)testSetRoot_setRootViewControllerOnMainWindow {
  206. [self.uut setReadyToReceiveCommands:true];
  207. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(self.vc1);
  208. [[self.mainWindow expect] setRootViewController:self.vc1];
  209. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  210. [self.mainWindow verify];
  211. }
  212. - (void)testSetStackRoot_resetStackWithSingleComponent {
  213. OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(@[self.vc2]);
  214. [self.uut setReadyToReceiveCommands:true];
  215. id classMock = OCMClassMock([RNNLayoutManager class]);
  216. OCMStub(ClassMethod([classMock findComponentForId:@"vc1"])).andReturn(_nvc);
  217. self.vc2.options.animations.setStackRoot.enable = [[Bool alloc] initWithBOOL:NO];
  218. [self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
  219. } rejection:^(NSString *code, NSString *message, NSError *error) {
  220. }];
  221. XCTAssertEqual(_nvc.viewControllers.firstObject, self.vc2);
  222. XCTAssertEqual(_nvc.viewControllers.count, 1);
  223. }
  224. - (void)testSetStackRoot_setMultipleChildren {
  225. NSArray* newViewControllers = @[_vc1, _vc3];
  226. id classMock = OCMClassMock([RNNLayoutManager class]);
  227. OCMStub(ClassMethod([classMock findComponentForId:@"vc1"])).andReturn(_nvc);
  228. OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
  229. [self.uut setReadyToReceiveCommands:true];
  230. _vc3.options.animations.setStackRoot.enable = [[Bool alloc] initWithBOOL:NO];
  231. [self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
  232. } rejection:^(NSString *code, NSString *message, NSError *error) {
  233. }];
  234. XCTAssertTrue([_nvc.viewControllers isEqual:newViewControllers]);
  235. }
  236. - (void)testSetStackRoot_callRenderTreeAndWaitOnce {
  237. id vc1Mock = [OCMockObject partialMockForObject:_vc1];
  238. id vc2Mock = [OCMockObject partialMockForObject:_vc2];
  239. NSArray* newViewControllers = @[vc1Mock, vc2Mock];
  240. OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
  241. [self.uut setReadyToReceiveCommands:true];
  242. [self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
  243. } rejection:^(NSString *code, NSString *message, NSError *error) {
  244. }];
  245. [[vc1Mock expect] render];
  246. [[vc2Mock expect] render];
  247. }
  248. - (void)testSetStackRoot_waitForRender {
  249. _vc2.options.animations.setStackRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
  250. id vc1Mock = OCMPartialMock(_vc1);
  251. id vc2Mock = OCMPartialMock(_vc2);
  252. NSArray* newViewControllers = @[vc1Mock, vc2Mock];
  253. OCMStub([self.controllerFactory createChildrenLayout:[OCMArg any]]).andReturn(newViewControllers);
  254. [self.uut setReadyToReceiveCommands:true];
  255. [self.uut setStackRoot:@"vc1" commandId:@"" children:nil completion:^{
  256. } rejection:^(NSString *code, NSString *message, NSError *error) {
  257. }];
  258. [[vc1Mock expect] render];
  259. [[vc2Mock expect] render];
  260. }
  261. - (void)testSetRoot_waitForRenderTrue {
  262. [self.uut setReadyToReceiveCommands:true];
  263. self.vc1.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  264. self.vc1.options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
  265. id mockedVC = [OCMockObject partialMockForObject:self.vc1];
  266. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);
  267. [[mockedVC expect] render];
  268. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  269. [mockedVC verify];
  270. }
  271. - (void)testSetRoot_waitForRenderFalse {
  272. [self.uut setReadyToReceiveCommands:true];
  273. self.vc1.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  274. self.vc1.options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:NO];
  275. id mockedVC = [OCMockObject partialMockForObject:self.vc1];
  276. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);
  277. [[mockedVC expect] render];
  278. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  279. [mockedVC verify];
  280. }
  281. - (void)testSetRoot_withBottomTabsAttachModeTogether {
  282. [self.uut setReadyToReceiveCommands:true];
  283. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initEmptyOptions];
  284. options.bottomTabs.tabsAttachMode = [[BottomTabsAttachMode alloc] initWithValue:@"together"];
  285. BottomTabsBaseAttacher* attacher = [[[BottomTabsAttachModeFactory alloc] initWithDefaultOptions:nil] fromOptions:options];
  286. RNNBottomTabsController* tabBarController = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:options defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:[RNNBasePresenter new] eventEmitter:_eventEmmiter childViewControllers:@[_vc1, _vc2] bottomTabsAttacher:attacher];
  287. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(tabBarController);
  288. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  289. XCTAssertTrue(_vc1.isViewLoaded);
  290. XCTAssertTrue(_vc2.isViewLoaded);
  291. XCTAssertEqual(_vc1.view.tag, 1);
  292. XCTAssertEqual(_vc2.view.tag, 2);
  293. }
  294. - (void)testSetRoot_withBottomTabsAttachModeOnSwitchToTab {
  295. [self.uut setReadyToReceiveCommands:true];
  296. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initEmptyOptions];
  297. options.bottomTabs.tabsAttachMode = [[BottomTabsAttachMode alloc] initWithValue:@"onSwitchToTab"];
  298. options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
  299. BottomTabsBaseAttacher* attacher = [[[BottomTabsAttachModeFactory alloc] initWithDefaultOptions:nil] fromOptions:options];
  300. RNNBottomTabsController* tabBarController = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:options defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:[RNNBasePresenter new] eventEmitter:_eventEmmiter childViewControllers:@[_vc1, _vc2] bottomTabsAttacher:attacher];
  301. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(tabBarController);
  302. [self.uut setRoot:@{} commandId:@"" completion:^{}];
  303. XCTAssertTrue(_vc1.isViewLoaded);
  304. XCTAssertFalse(_vc2.isViewLoaded);
  305. [tabBarController setSelectedIndex:1];
  306. XCTAssertTrue(_vc2.isViewLoaded);
  307. }
  308. - (void)testSetRoot_withBottomTabsAttachModeAfterInitialTab {
  309. [self.uut setReadyToReceiveCommands:true];
  310. RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initEmptyOptions];
  311. options.bottomTabs.tabsAttachMode = [[BottomTabsAttachMode alloc] initWithValue:@"afterInitialTab"];
  312. options.animations.setRoot.waitForRender = [[Bool alloc] initWithBOOL:YES];
  313. BottomTabsBaseAttacher* attacher = [[[BottomTabsAttachModeFactory alloc] initWithDefaultOptions:nil] fromOptions:options];
  314. RNNBottomTabsController* tabBarController = [[RNNBottomTabsController alloc] initWithLayoutInfo:nil creator:nil options:options defaultOptions:[[RNNNavigationOptions alloc] initEmptyOptions] presenter:[RNNBasePresenter new] eventEmitter:_eventEmmiter childViewControllers:@[_vc1, _vc2] bottomTabsAttacher:attacher];
  315. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(tabBarController);
  316. [self.uut setRoot:@{} commandId:@"" completion:^{
  317. XCTAssertFalse(self->_vc2.isViewLoaded);
  318. }];
  319. XCTAssertTrue(_vc1.isViewLoaded);
  320. XCTAssertTrue(_vc2.isViewLoaded);
  321. }
  322. - (void)testShowModal_shouldShowAnimated {
  323. [self.uut setReadyToReceiveCommands:true];
  324. self.vc1.options = [[RNNNavigationOptions alloc] initEmptyOptions];
  325. self.vc1.options.animations.showModal.enable = [[Bool alloc] initWithBOOL:YES];
  326. id mockedVC = [OCMockObject partialMockForObject:self.vc1];
  327. OCMStub([self.controllerFactory createLayout:[OCMArg any]]).andReturn(mockedVC);
  328. [[self.modalManager expect] showModal:mockedVC animated:YES completion:[OCMArg any]];
  329. [self.uut showModal:@{} commandId:@"showModal" completion:^(NSString *componentId) {
  330. }];
  331. [self.modalManager verify];
  332. }
  333. @end