|
@@ -1,4 +1,5 @@
|
1
|
1
|
#import <XCTest/XCTest.h>
|
|
2
|
+#import <OCMock/OCMock.h>
|
2
|
3
|
#import "RNNModalManager.h"
|
3
|
4
|
#import "RNNComponentViewController.h"
|
4
|
5
|
|
|
@@ -107,6 +108,27 @@
|
107
|
108
|
XCTAssertTrue(_modalManager.topPresentedVC.presentViewControllerCalls == 1);
|
108
|
109
|
}
|
109
|
110
|
|
|
111
|
+- (void)testDismissModal_ShouldInvokeDelegateDismissedModal {
|
|
112
|
+ id mockDelegate = [OCMockObject mockForProtocol:@protocol(RNNModalManagerDelegate)];
|
|
113
|
+ _modalManager.delegate = mockDelegate;
|
|
114
|
+ [_modalManager showModal:_vc1 animated:NO completion:nil];
|
|
115
|
+
|
|
116
|
+ [[mockDelegate expect] dismissedModal:_vc1];
|
|
117
|
+ [_modalManager dismissModal:_vc1 completion:nil];
|
|
118
|
+ [mockDelegate verify];
|
|
119
|
+}
|
|
120
|
+
|
|
121
|
+- (void)testPresentationControllerDidDismiss_ShouldInvokeDelegateDismissedModal {
|
|
122
|
+ id mockDelegate = [OCMockObject mockForProtocol:@protocol(RNNModalManagerDelegate)];
|
|
123
|
+ _modalManager.delegate = mockDelegate;
|
|
124
|
+
|
|
125
|
+ UIPresentationController* presentationController = [[UIPresentationController alloc] initWithPresentedViewController:_vc2 presentingViewController:_vc1];
|
|
126
|
+
|
|
127
|
+ [[mockDelegate expect] dismissedModal:_vc2];
|
|
128
|
+ [_modalManager presentationControllerDidDismiss:presentationController];
|
|
129
|
+ [mockDelegate verify];
|
|
130
|
+}
|
|
131
|
+
|
110
|
132
|
#pragma mark RNNModalManagerDelegate
|
111
|
133
|
|
112
|
134
|
- (void)dismissedMultipleModals:(NSArray *)viewControllers {
|