forked from wix/react-native-navigation
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathRNNNavigationOptionsTest.m
59 lines (50 loc) · 2.59 KB
/
RNNNavigationOptionsTest.m
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
#import <XCTest/XCTest.h>
#import "RNNNavigationOptions.h"
@interface RNNNavigationOptionsTest : XCTestCase
@end
@implementation RNNNavigationOptionsTest
- (void)setUp {
[super setUp];
}
- (void)testInitCreatesInstanceType {
RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{}];
XCTAssertTrue([options isKindOfClass:[RNNNavigationOptions class]]);
}
- (void)testAddsStyleFromDictionaryWithInit {
RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"background" : @{@"color" : @(0xff0000ff)}}}];
XCTAssertTrue(options.topBar.background.color);
}
- (void)testChangeRNNNavigationOptionsDynamically {
RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"background" : @{@"color" : @(0xff0000ff)}}}];
NSDictionary* dynamicOptionsDict = @{@"topBar": @{@"textColor" : @(0xffff00ff), @"title" : @{@"text": @"hello"}}};
RNNNavigationOptions* dynamicOptions = [[RNNNavigationOptions alloc] initWithDict:dynamicOptionsDict];
[options overrideOptions:dynamicOptions];
XCTAssertTrue([options.topBar.title.text.get isEqual:@"hello"]);
}
- (void)testChangeRNNNavigationOptionsWithInvalidProperties {
RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initWithDict:@{@"topBar": @{@"background" : @{@"color" : @(0xff0000ff)}}}];
NSDictionary* dynamicOptionsDict = @{@"topBar": @{@"titleeeee" : @"hello"}};
RNNNavigationOptions* dynamicOptions = [[RNNNavigationOptions alloc] initWithDict:dynamicOptionsDict];
XCTAssertNoThrow([options overrideOptions:dynamicOptions]);
}
//
//- (void)test_applyDefaultOptions {
// RNNNavigationOptions* options = [[RNNNavigationOptions alloc] initEmptyOptions];
// UIViewController* viewController = [UIViewController new];
// UINavigationController* navigationController = [[UINavigationController alloc] initWithRootViewController:viewController];
// UITabBarController* tabBarController = [[UITabBarController alloc] init];
// [tabBarController setViewControllers:@[navigationController]];
//
// [options applyDefaultOptionsOn:viewController];
//
// XCTAssertFalse(navigationController.navigationBar.hidden);
// XCTAssertFalse(navigationController.navigationBar.translucent);
// XCTAssertFalse(navigationController.navigationBar.clipsToBounds);
// XCTAssertFalse(navigationController.hidesBarsOnSwipe);
// XCTAssertTrue(navigationController.navigationBar.barStyle == UIBarStyleDefault);
//
// XCTAssertNil(tabBarController.tabBar.barTintColor);
// XCTAssertTrue(tabBarController.tabBar.barStyle == UIBarStyleDefault);
// XCTAssertFalse(tabBarController.tabBar.translucent);
//}
@end