|
@@ -7,7 +7,7 @@
|
7
|
7
|
|
8
|
8
|
@property (nonatomic, strong) RNNSideMenuPresenter *uut;
|
9
|
9
|
@property (nonatomic, strong) RNNNavigationOptions *options;
|
10
|
|
-@property (nonatomic, strong) id bindedViewController;
|
|
10
|
+@property (nonatomic, strong) id boundViewController;
|
11
|
11
|
|
12
|
12
|
@end
|
13
|
13
|
|
|
@@ -16,25 +16,25 @@
|
16
|
16
|
- (void)setUp {
|
17
|
17
|
[super setUp];
|
18
|
18
|
self.uut = [[RNNSideMenuPresenter alloc] init];
|
19
|
|
- self.bindedViewController = [OCMockObject partialMockForObject:[RNNSideMenuController new]];
|
20
|
|
- [self.uut bindViewController:self.bindedViewController];
|
|
19
|
+ self.boundViewController = [OCMockObject partialMockForObject:[RNNSideMenuController new]];
|
|
20
|
+ [self.uut bindViewController:self.boundViewController];
|
21
|
21
|
self.options = [[RNNNavigationOptions alloc] initEmptyOptions];
|
22
|
22
|
}
|
23
|
23
|
|
24
|
24
|
- (void)testApplyOptionsShouldSetDefaultValues {
|
25
|
|
- [[self.bindedViewController expect] side:MMDrawerSideLeft enabled:YES];
|
26
|
|
- [[self.bindedViewController expect] side:MMDrawerSideRight enabled:YES];
|
27
|
|
- [[self.bindedViewController expect] setShouldStretchLeftDrawer:YES];
|
28
|
|
- [[self.bindedViewController expect] setShouldStretchRightDrawer:YES];
|
29
|
|
- [[self.bindedViewController expect] setAnimationVelocityLeft:840.0f];
|
30
|
|
- [[self.bindedViewController expect] setAnimationVelocityRight:840.0f];
|
31
|
|
- [[self.bindedViewController reject] side:MMDrawerSideLeft width:0];
|
32
|
|
- [[self.bindedViewController reject] side:MMDrawerSideRight width:0];
|
33
|
|
- [[self.bindedViewController expect] setAnimationType:nil];
|
|
25
|
+ [[self.boundViewController expect] side:MMDrawerSideLeft enabled:YES];
|
|
26
|
+ [[self.boundViewController expect] side:MMDrawerSideRight enabled:YES];
|
|
27
|
+ [[self.boundViewController expect] setShouldStretchLeftDrawer:YES];
|
|
28
|
+ [[self.boundViewController expect] setShouldStretchRightDrawer:YES];
|
|
29
|
+ [[self.boundViewController expect] setAnimationVelocityLeft:840.0f];
|
|
30
|
+ [[self.boundViewController expect] setAnimationVelocityRight:840.0f];
|
|
31
|
+ [[self.boundViewController reject] side:MMDrawerSideLeft width:0];
|
|
32
|
+ [[self.boundViewController reject] side:MMDrawerSideRight width:0];
|
|
33
|
+ [[self.boundViewController expect] setAnimationType:nil];
|
34
|
34
|
|
35
|
35
|
[self.uut applyOptions:self.options];
|
36
|
36
|
|
37
|
|
- [self.bindedViewController verify];
|
|
37
|
+ [self.boundViewController verify];
|
38
|
38
|
}
|
39
|
39
|
|
40
|
40
|
- (void)testApplyOptionsShouldSetInitialValues {
|
|
@@ -45,41 +45,49 @@
|
45
|
45
|
self.options.sideMenu.right.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
|
46
|
46
|
self.options.sideMenu.left.animationVelocity = [[Double alloc] initWithValue:@(100.0f)];
|
47
|
47
|
|
48
|
|
- [[self.bindedViewController expect] side:MMDrawerSideLeft enabled:NO];
|
49
|
|
- [[self.bindedViewController expect] side:MMDrawerSideRight enabled:NO];
|
50
|
|
- [[self.bindedViewController expect] setShouldStretchLeftDrawer:NO];
|
51
|
|
- [[self.bindedViewController expect] setShouldStretchRightDrawer:NO];
|
52
|
|
- [[self.bindedViewController expect] setAnimationVelocityLeft:100.0f];
|
53
|
|
- [[self.bindedViewController expect] setAnimationVelocityRight:100.0f];
|
|
48
|
+ [[self.boundViewController expect] side:MMDrawerSideLeft enabled:NO];
|
|
49
|
+ [[self.boundViewController expect] side:MMDrawerSideRight enabled:NO];
|
|
50
|
+ [[self.boundViewController expect] setShouldStretchLeftDrawer:NO];
|
|
51
|
+ [[self.boundViewController expect] setShouldStretchRightDrawer:NO];
|
|
52
|
+ [[self.boundViewController expect] setAnimationVelocityLeft:100.0f];
|
|
53
|
+ [[self.boundViewController expect] setAnimationVelocityRight:100.0f];
|
54
|
54
|
|
55
|
55
|
[self.uut applyOptions:self.options];
|
56
|
56
|
|
57
|
|
- [self.bindedViewController verify];
|
|
57
|
+ [self.boundViewController verify];
|
58
|
58
|
}
|
59
|
59
|
|
60
|
60
|
- (void)testApplyOptionsOnInitShouldSetWidthOptions {
|
61
|
61
|
self.options.sideMenu.right.width = [[Double alloc] initWithValue:@(100.0f)];
|
62
|
62
|
self.options.sideMenu.left.width = [[Double alloc] initWithValue:@(100.0f)];
|
63
|
63
|
|
64
|
|
- [[self.bindedViewController expect] side:MMDrawerSideLeft width:100.0f];
|
65
|
|
- [[self.bindedViewController expect] side:MMDrawerSideRight width:100.0f];
|
|
64
|
+ [[self.boundViewController expect] side:MMDrawerSideLeft width:100.0f];
|
|
65
|
+ [[self.boundViewController expect] side:MMDrawerSideRight width:100.0f];
|
66
|
66
|
|
67
|
67
|
[self.uut applyOptionsOnInit:self.options];
|
68
|
68
|
|
69
|
|
- [self.bindedViewController verify];
|
|
69
|
+ [self.boundViewController verify];
|
70
|
70
|
}
|
71
|
71
|
|
72
|
72
|
- (void)testApplyOptionsOnInitShouldSetDefaultDrawerGestureMode {
|
73
|
|
- [[self.bindedViewController expect] setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
|
|
73
|
+ [[self.boundViewController expect] setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeAll];
|
74
|
74
|
[self.uut applyOptionsOnInit:self.options];
|
75
|
|
- [self.bindedViewController verify];
|
|
75
|
+ [self.boundViewController verify];
|
76
|
76
|
}
|
77
|
77
|
|
78
|
78
|
- (void)testApplyOptionsOnInitShouldSetBezelDrawerGestureMode {
|
79
|
79
|
self.options.sideMenu.openGestureMode = [[SideMenuOpenMode alloc] initWithValue:@(MMOpenDrawerGestureModeNone)];
|
80
|
|
- [[self.bindedViewController expect] setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
|
|
80
|
+ [[self.boundViewController expect] setOpenDrawerGestureModeMask:MMOpenDrawerGestureModeNone];
|
81
|
81
|
[self.uut applyOptionsOnInit:self.options];
|
82
|
|
- [self.bindedViewController verify];
|
|
82
|
+ [self.boundViewController verify];
|
|
83
|
+}
|
|
84
|
+
|
|
85
|
+- (void)testBackgroundColor_validColor {
|
|
86
|
+ UIColor* inputColor = [RCTConvert UIColor:@(0xFFFF0000)];
|
|
87
|
+ self.options.layout.backgroundColor = [[Color alloc] initWithValue:inputColor];
|
|
88
|
+ [self.uut applyOptions:self.options];
|
|
89
|
+ UIColor* expectedColor = [UIColor colorWithRed:1 green:0 blue:0 alpha:1];
|
|
90
|
+ XCTAssertTrue([((UIViewController *)self.boundViewController).view.backgroundColor isEqual:expectedColor]);
|
83
|
91
|
}
|
84
|
92
|
|
85
|
93
|
@end
|