Quellcode durchsuchen

Revert "Added unit test coverage for RNNNavigationController"

This reverts commit 40a590bddd.
yogevbd vor 6 Jahren
Ursprung
Commit
199cebd221

+ 6
- 6
lib/ios/RNNNavigationController.m Datei anzeigen

@@ -59,16 +59,16 @@
59 59
 
60 60
 - (void)setViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers {
61 61
 	[super setViewControllers:viewControllers];
62
-    for (UIViewController<RNNRootViewProtocol>* viewController in viewControllers) {
63
-        if ([viewController respondsToSelector:@selector(layoutInfo)]) {
64
-            [viewController.layoutInfo.options mergeOptions:self.layoutInfo.options overrideOptions:NO];
65
-        }
66
-    }
62
+	for (UIViewController<RNNRootViewProtocol>* viewController in viewControllers) {
63
+		if (viewController.layoutInfo.options) {
64
+			[viewController.layoutInfo.options mergeOptions:self.layoutInfo.options overrideOptions:NO];
65
+		}
66
+	}
67 67
 }
68 68
 
69 69
 - (void)pushViewController:(UIViewController<RNNRootViewProtocol> *)viewController animated:(BOOL)animated {
70 70
 	[super pushViewController:viewController animated:animated];
71
-    if ([viewController respondsToSelector:@selector(layoutInfo)]) {
71
+	if (viewController.layoutInfo.options) {
72 72
 		[viewController.layoutInfo.options mergeOptions:self.layoutInfo.options overrideOptions:NO];
73 73
 	}
74 74
 }

+ 1
- 1
lib/ios/RNNOptions.m Datei anzeigen

@@ -4,7 +4,7 @@
4 4
 
5 5
 @implementation RNNOptions
6 6
 
7
-- (instancetype)initWithDict:(NSDictionary *)dict {
7
+-(instancetype)	initWithDict:(NSDictionary *)dict {
8 8
 	self = [super init];
9 9
 	[self initializeOptionsPropertiesWithDict:dict];
10 10
 	

+ 0
- 4
lib/ios/ReactNativeNavigation.xcodeproj/project.pbxproj Datei anzeigen

@@ -98,7 +98,6 @@
98 98
 		50570B272061473D006A1B5C /* RNNTitleOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 50570B252061473D006A1B5C /* RNNTitleOptions.m */; };
99 99
 		50570BEA2063E09B006A1B5C /* RNNTitleViewHelper.h in Headers */ = {isa = PBXBuildFile; fileRef = 50570BE82063E09B006A1B5C /* RNNTitleViewHelper.h */; };
100 100
 		50570BEB2063E09B006A1B5C /* RNNTitleViewHelper.m in Sources */ = {isa = PBXBuildFile; fileRef = 50570BE92063E09B006A1B5C /* RNNTitleViewHelper.m */; };
101
-		505EDD32214E4BE80071C7DE /* RNNNavigationControllerTest.m in Sources */ = {isa = PBXBuildFile; fileRef = 505EDD31214E4BE80071C7DE /* RNNNavigationControllerTest.m */; };
102 101
 		5064495D20DC62B90026709C /* RNNSideMenuSideOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 5064495B20DC62B90026709C /* RNNSideMenuSideOptions.h */; };
103 102
 		5064495E20DC62B90026709C /* RNNSideMenuSideOptions.m in Sources */ = {isa = PBXBuildFile; fileRef = 5064495C20DC62B90026709C /* RNNSideMenuSideOptions.m */; };
104 103
 		50644A2020E11A720026709C /* Constants.h in Headers */ = {isa = PBXBuildFile; fileRef = 50644A1E20E11A720026709C /* Constants.h */; };
@@ -330,7 +329,6 @@
330 329
 		50570B252061473D006A1B5C /* RNNTitleOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTitleOptions.m; sourceTree = "<group>"; };
331 330
 		50570BE82063E09B006A1B5C /* RNNTitleViewHelper.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNTitleViewHelper.h; sourceTree = "<group>"; };
332 331
 		50570BE92063E09B006A1B5C /* RNNTitleViewHelper.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNTitleViewHelper.m; sourceTree = "<group>"; };
333
-		505EDD31214E4BE80071C7DE /* RNNNavigationControllerTest.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNNavigationControllerTest.m; sourceTree = "<group>"; };
334 332
 		5064495B20DC62B90026709C /* RNNSideMenuSideOptions.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = RNNSideMenuSideOptions.h; sourceTree = "<group>"; };
335 333
 		5064495C20DC62B90026709C /* RNNSideMenuSideOptions.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = RNNSideMenuSideOptions.m; sourceTree = "<group>"; };
336 334
 		50644A1E20E11A720026709C /* Constants.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = Constants.h; sourceTree = "<group>"; };
@@ -714,7 +712,6 @@
714 712
 				7B49FEC91E95098500DEB3EA /* RNNCommandsHandlerTest.m */,
715 713
 				7B49FECA1E95098500DEB3EA /* RNNNavigationStackManagerTest.m */,
716 714
 				504753772109C13C00FFFBE6 /* RNNOverlayManagerTest.m */,
717
-				505EDD31214E4BE80071C7DE /* RNNNavigationControllerTest.m */,
718 715
 				7B49FEBF1E95090800DEB3EA /* Info.plist */,
719 716
 				E83BAD671F2734B500A9F3DD /* RNNNavigationOptionsTest.m */,
720 717
 				E83BAD781F27416B00A9F3DD /* RNNRootViewControllerTest.m */,
@@ -1029,7 +1026,6 @@
1029 1026
 				504753782109C13C00FFFBE6 /* RNNOverlayManagerTest.m in Sources */,
1030 1027
 				7B49FECE1E95098500DEB3EA /* RNNCommandsHandlerTest.m in Sources */,
1031 1028
 				E83BAD681F2734B500A9F3DD /* RNNNavigationOptionsTest.m in Sources */,
1032
-				505EDD32214E4BE80071C7DE /* RNNNavigationControllerTest.m in Sources */,
1033 1029
 				7B49FECF1E95098500DEB3EA /* RNNNavigationStackManagerTest.m in Sources */,
1034 1030
 				7B49FECB1E95098500DEB3EA /* RNNControllerFactoryTest.m in Sources */,
1035 1031
 				7B49FECD1E95098500DEB3EA /* RNNModalManagerTest.m in Sources */,

+ 0
- 68
lib/ios/ReactNativeNavigationTests/RNNNavigationControllerTest.m Datei anzeigen

@@ -1,68 +0,0 @@
1
-#import <XCTest/XCTest.h>
2
-#import "RNNNavigationController.h"
3
-
4
-@interface RNNNavigationControllerTest : XCTestCase
5
-
6
-@property (nonatomic, strong) RNNNavigationController *uut;
7
-
8
-@end
9
-
10
-@implementation RNNNavigationControllerTest {
11
-	RNNRootViewController* _vc1;
12
-	RNNRootViewController* _vc2;
13
-	UIViewController* _vc3;
14
-}
15
-
16
-- (void)setUp {
17
-    [super setUp];
18
-	
19
-	self.uut = [[RNNNavigationController alloc] initWithLayoutInfo:[self createLayoutInfo]];
20
-	_vc1 = [[RNNRootViewController alloc] init];
21
-	_vc1.layoutInfo = [self createLayoutInfo];
22
-	_vc2 = [[RNNRootViewController alloc] init];
23
-	_vc2.layoutInfo = [self createLayoutInfo];
24
-	_vc3 = [UIViewController new];
25
-}
26
-
27
-- (void)testSetViewControllers_shouldPropogateOptionsToViewController {
28
-	self.uut.layoutInfo.options.topBar.visible = @(1);
29
-	[self.uut setViewControllers:@[_vc1]];
30
-	XCTAssertTrue(_vc1.layoutInfo.options.topBar.visible.boolValue == self.uut.layoutInfo.options.topBar.visible.boolValue);
31
-}
32
-
33
-- (void)testSetViewControllers_externalViewControllerShouldNotCrash {
34
-	NSArray* viewControllers = @[_vc1, _vc3];
35
-	XCTAssertNoThrow([self.uut setViewControllers:viewControllers]);
36
-}
37
-
38
-- (void)testPushViewController_shouldPropogateOptionsToViewController {
39
-	self.uut.layoutInfo.options.topBar.visible = @(1);
40
-	[self.uut pushViewController:_vc2 animated:NO];
41
-	XCTAssertTrue(_vc2.layoutInfo.options.topBar.visible.boolValue == self.uut.layoutInfo.options.topBar.visible.boolValue);
42
-}
43
-
44
-- (void)testPushViewController_externalViewControllerShouldNotCrash {
45
-	XCTAssertNoThrow([self.uut pushViewController:_vc3 animated:NO]);
46
-}
47
-
48
-- (void)testChildViewControllerForStatusBarStyle_shouldReturnTopViewController {
49
-	XCTAssertTrue(self.uut.childViewControllerForStatusBarStyle == self.uut.topViewController);
50
-}
51
-
52
-- (void)testGetLeafViewController_shouldReturnTopViewController {
53
-	XCTAssertTrue(self.uut.getLeafViewController == self.uut.topViewController);
54
-}
55
-
56
-- (void)testPreferredStatusBarStyle_shouldReturnLeafPreferredStatusBarStyle {
57
-	[self.uut setViewControllers:@[_vc1]];
58
-	self.uut.getLeafViewController.layoutInfo.options.statusBar.style = @"dark";
59
-	XCTAssertTrue(self.uut.preferredStatusBarStyle == self.uut.getLeafViewController.preferredStatusBarStyle);
60
-}
61
-
62
-- (RNNLayoutInfo *)createLayoutInfo {
63
-	RNNLayoutInfo *layoutInfo = [RNNLayoutInfo new];
64
-	layoutInfo.options = [[RNNNavigationOptions alloc] initWithDict:@{}];
65
-	return layoutInfo;
66
-}
67
-
68
-@end