|
@@ -2,6 +2,7 @@ package com.reactnativenavigation.viewcontrollers;
|
2
|
2
|
|
3
|
3
|
import android.app.Activity;
|
4
|
4
|
import android.content.Context;
|
|
5
|
+import android.support.annotation.NonNull;
|
5
|
6
|
|
6
|
7
|
import com.reactnativenavigation.BaseTest;
|
7
|
8
|
import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
|
|
@@ -19,38 +20,31 @@ import static org.mockito.Mockito.verify;
|
19
|
20
|
public class TopBarControllerTest extends BaseTest {
|
20
|
21
|
|
21
|
22
|
private TopBarController uut;
|
22
|
|
- private TitleBar titleBar;
|
23
|
|
- private TopBar topBar;
|
24
|
|
- private Activity activity;
|
25
|
23
|
|
26
|
24
|
@Override
|
27
|
25
|
public void beforeEach() {
|
28
|
|
- activity = newActivity();
|
|
26
|
+ uut = new TopBarController();
|
|
27
|
+ }
|
|
28
|
+
|
|
29
|
+ @Test
|
|
30
|
+ public void clear() {
|
|
31
|
+ final TitleBar[] titleBar = new TitleBar[1];
|
29
|
32
|
uut = new TopBarController() {
|
|
33
|
+ @NonNull
|
30
|
34
|
@Override
|
31
|
35
|
protected TopBar createTopBar(Context context, StackLayout stackLayout) {
|
32
|
|
- topBar = spy(new TopBar(context, stackLayout) {
|
|
36
|
+ return new TopBar(context, stackLayout) {
|
33
|
37
|
@Override
|
34
|
38
|
protected TitleBar createTitleBar(Context context) {
|
35
|
|
- titleBar = spy(super.createTitleBar(context));
|
36
|
|
- return titleBar;
|
|
39
|
+ titleBar[0] = spy(super.createTitleBar(context));
|
|
40
|
+ return titleBar[0];
|
37
|
41
|
}
|
38
|
|
- });
|
39
|
|
- return topBar;
|
|
42
|
+ };
|
40
|
43
|
}
|
41
|
44
|
};
|
42
|
|
- }
|
43
|
|
-
|
44
|
|
- @Test
|
45
|
|
- public void createView_setElevationToCancelDefaultElevationAnimationWhichMightConflictWithElevationValueFromDefaultOptions() {
|
46
|
|
- uut.createView(activity, Mockito.mock(StackLayout.class));
|
47
|
|
- verify(topBar).setElevation(0);
|
48
|
|
- }
|
49
|
|
-
|
50
|
|
- @Test
|
51
|
|
- public void clear() {
|
|
45
|
+ Activity activity = newActivity();
|
52
|
46
|
uut.createView(activity, Mockito.mock(StackLayout.class));
|
53
|
47
|
uut.clear();
|
54
|
|
- verify(titleBar, times(1)).clear();
|
|
48
|
+ verify(titleBar[0], times(1)).clear();
|
55
|
49
|
}
|
56
|
50
|
}
|