|
|
|
|
45
|
}
|
45
|
}
|
46
|
|
46
|
|
47
|
- (void)testFindComponentShouldReturnModalFromFirstWindow {
|
47
|
- (void)testFindComponentShouldReturnModalFromFirstWindow {
|
|
|
48
|
+ UIViewController* rootViewController = [OCMockObject partialMockForObject:[UIViewController new]];
|
|
|
49
|
+
|
48
|
UIViewController* modal = _vc1;
|
50
|
UIViewController* modal = _vc1;
|
49
|
- OCMStub([_vc2 presentedViewController]).andReturn(modal);
|
|
|
50
|
- _firstWindow.rootViewController = _vc2;
|
|
|
|
|
51
|
+ OCMStub([rootViewController presentedViewController]).andReturn(modal);
|
|
|
52
|
+ _firstWindow.rootViewController = rootViewController;
|
51
|
UIViewController *resultVC = [RNNLayoutManager findComponentForId:@"vc1"];
|
53
|
UIViewController *resultVC = [RNNLayoutManager findComponentForId:@"vc1"];
|
52
|
XCTAssertEqual(resultVC, modal);
|
54
|
XCTAssertEqual(resultVC, modal);
|
53
|
}
|
55
|
}
|
54
|
|
56
|
|
55
|
- (void)testFindComponentShouldReturnModalFromSecondWindow {
|
57
|
- (void)testFindComponentShouldReturnModalFromSecondWindow {
|
|
|
58
|
+ UIViewController* rootViewController = [OCMockObject partialMockForObject:[UIViewController new]];
|
56
|
UIViewController* modal = _vc1;
|
59
|
UIViewController* modal = _vc1;
|
57
|
- OCMStub([_vc2 presentedViewController]).andReturn(modal);
|
|
|
58
|
- _secondWindow.rootViewController = _vc2;
|
|
|
|
|
60
|
+ OCMStub([rootViewController presentedViewController]).andReturn(modal);
|
|
|
61
|
+ _secondWindow.rootViewController = rootViewController;
|
59
|
UIViewController *resultVC = [RNNLayoutManager findComponentForId:@"vc1"];
|
62
|
UIViewController *resultVC = [RNNLayoutManager findComponentForId:@"vc1"];
|
60
|
XCTAssertEqual(resultVC, modal);
|
63
|
XCTAssertEqual(resultVC, modal);
|
61
|
}
|
64
|
}
|
|
|
|
|
70
|
UINavigationController* nvc = [[UINavigationController alloc] init];
|
73
|
UINavigationController* nvc = [[UINavigationController alloc] init];
|
71
|
[nvc setViewControllers:@[_vc1, _vc2, _vc3]];
|
74
|
[nvc setViewControllers:@[_vc1, _vc2, _vc3]];
|
72
|
_secondWindow.rootViewController = nvc;
|
75
|
_secondWindow.rootViewController = nvc;
|
73
|
-
|
|
|
|
|
76
|
+
|
74
|
UIViewController *resultVC = [RNNLayoutManager findComponentForId:@"vc3"];
|
77
|
UIViewController *resultVC = [RNNLayoutManager findComponentForId:@"vc3"];
|
75
|
XCTAssertEqual(resultVC, _vc3);
|
78
|
XCTAssertEqual(resultVC, _vc3);
|
76
|
}
|
79
|
}
|
|
|
|
|
79
|
RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
|
82
|
RNNLayoutInfo* layoutInfo = [RNNLayoutInfo new];
|
80
|
layoutInfo.componentId = componentId;
|
83
|
layoutInfo.componentId = componentId;
|
81
|
|
84
|
|
82
|
- UIViewController* vc = [OCMockObject partialMockForObject:[UIViewController new]];
|
|
|
83
|
- OCMStub([vc layoutInfo]).andReturn(layoutInfo);
|
|
|
|
|
85
|
+ UIViewController* vc = [UIViewController new];
|
|
|
86
|
+ vc.layoutInfo = layoutInfo;
|
84
|
|
87
|
|
85
|
return vc;
|
88
|
return vc;
|
86
|
}
|
89
|
}
|