|
@@ -18,7 +18,7 @@
|
18
|
18
|
@implementation RNNRootViewControllerTest
|
19
|
19
|
|
20
|
20
|
- (void)setUp {
|
21
|
|
- [super setUp];
|
|
21
|
+ [super setUp];
|
22
|
22
|
self.creator = [[RNNTestRootViewCreator alloc] init];
|
23
|
23
|
self.pageName = @"somename";
|
24
|
24
|
self.containerId = @"cntId";
|
|
@@ -47,7 +47,7 @@
|
47
|
47
|
- (void)testStatusBarHidden_default {
|
48
|
48
|
__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
|
49
|
49
|
[self.uut viewWillAppear:false];
|
50
|
|
-
|
|
50
|
+
|
51
|
51
|
XCTAssertFalse([self.uut prefersStatusBarHidden]);
|
52
|
52
|
}
|
53
|
53
|
|
|
@@ -109,13 +109,6 @@
|
109
|
109
|
XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
|
110
|
110
|
}
|
111
|
111
|
|
112
|
|
--(void)testTopBarTextFontFamily_invalidFont{
|
113
|
|
- NSString* inputFont = @"HelveticaNeueeeee";
|
114
|
|
- __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
|
115
|
|
- self.options.topBarTextFontFamily = inputFont;
|
116
|
|
- XCTAssertThrows([self.uut viewWillAppear:false]);
|
117
|
|
-}
|
118
|
|
-
|
119
|
112
|
-(void)testTopBarHideOnScroll_true {
|
120
|
113
|
NSNumber* hideOnScrollInput = @(1);
|
121
|
114
|
__unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
|
|
@@ -141,6 +134,75 @@
|
141
|
134
|
XCTAssertFalse(self.uut.navigationController.navigationBar.translucent);
|
142
|
135
|
}
|
143
|
136
|
|
|
137
|
+-(void)testTabBadge {
|
|
138
|
+ NSString* tabBadgeInput = @"5";
|
|
139
|
+ self.options.tabBadge = tabBadgeInput;
|
|
140
|
+ __unused UITabBarController* vc = [[UITabBarController alloc] init];
|
|
141
|
+ NSMutableArray* controllers = [NSMutableArray new];
|
|
142
|
+ UITabBarItem* item = [[UITabBarItem alloc] initWithTitle:@"A Tab" image:nil tag:1];
|
|
143
|
+ [self.uut setTabBarItem:item];
|
|
144
|
+ [controllers addObject:self.uut];
|
|
145
|
+ [vc setViewControllers:controllers];
|
|
146
|
+ [self.uut viewWillAppear:false];
|
|
147
|
+ XCTAssertTrue([self.uut.tabBarItem.badgeValue isEqualToString:tabBadgeInput]);
|
|
148
|
+
|
|
149
|
+}
|
|
150
|
+
|
144
|
151
|
|
|
152
|
+-(void)testTopBarTextFontSize_withoutTextFontFamily_withoutTextColor {
|
|
153
|
+ NSNumber* topBarTextFontSizeInput = @(15);
|
|
154
|
+ self.options.topBarTextFontSize = topBarTextFontSizeInput;
|
|
155
|
+ __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
|
|
156
|
+ [self.uut viewWillAppear:false];
|
|
157
|
+ UIFont* expectedFont = [UIFont systemFontOfSize:15];
|
|
158
|
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
|
|
159
|
+}
|
|
160
|
+
|
|
161
|
+-(void)testTopBarTextFontSize_withoutTextFontFamily_withTextColor {
|
|
162
|
+ NSNumber* topBarTextFontSizeInput = @(15);
|
|
163
|
+ NSNumber* inputColor = @(0xFFFF0000);
|
|
164
|
+ self.options.topBarTextFontSize = topBarTextFontSizeInput;
|
|
165
|
+ self.options.topBarTextColor = inputColor;
|
|
166
|
+ __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
|
|
167
|
+ [self.uut viewWillAppear:false];
|
|
168
|
+ UIFont* expectedFont = [UIFont systemFontOfSize:15];
|
|
169
|
+ UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
|
|
170
|
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
|
|
171
|
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
|
|
172
|
+}
|
|
173
|
+
|
|
174
|
+-(void)testTopBarTextFontSize_withTextFontFamily_withTextColor {
|
|
175
|
+ NSNumber* topBarTextFontSizeInput = @(15);
|
|
176
|
+ NSNumber* inputColor = @(0xFFFF0000);
|
|
177
|
+ NSString* inputFont = @"HelveticaNeue";
|
|
178
|
+ self.options.topBarTextFontSize = topBarTextFontSizeInput;
|
|
179
|
+ self.options.topBarTextColor = inputColor;
|
|
180
|
+ self.options.topBarTextFontFamily = inputFont;
|
|
181
|
+ __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
|
|
182
|
+ [self.uut viewWillAppear:false];
|
|
183
|
+ UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
|
|
184
|
+ UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
|
|
185
|
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
|
|
186
|
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSColor"] isEqual:expectedColor]);
|
|
187
|
+}
|
|
188
|
+
|
|
189
|
+-(void)testTopBarTextFontSize_withTextFontFamily_withoutTextColor {
|
|
190
|
+ NSNumber* topBarTextFontSizeInput = @(15);
|
|
191
|
+ NSString* inputFont = @"HelveticaNeue";
|
|
192
|
+ self.options.topBarTextFontSize = topBarTextFontSizeInput;
|
|
193
|
+ self.options.topBarTextFontFamily = inputFont;
|
|
194
|
+ __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
|
|
195
|
+ [self.uut viewWillAppear:false];
|
|
196
|
+ UIFont* expectedFont = [UIFont fontWithName:inputFont size:15];
|
|
197
|
+ XCTAssertTrue([self.uut.navigationController.navigationBar.titleTextAttributes[@"NSFont"] isEqual:expectedFont]);
|
|
198
|
+}
|
|
199
|
+
|
|
200
|
+// TODO: Currently not passing
|
|
201
|
+-(void)testTopBarTextFontFamily_invalidFont{
|
|
202
|
+ NSString* inputFont = @"HelveticaNeueeeee";
|
|
203
|
+ __unused UINavigationController* nav = [[UINavigationController alloc] initWithRootViewController:self.uut];
|
|
204
|
+ self.options.topBarTextFontFamily = inputFont;
|
|
205
|
+ // XCTAssertThrows([self.uut viewWillAppear:false]);
|
|
206
|
+}
|
145
|
207
|
|
146
|
208
|
@end
|