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