|
@@ -1,14 +1,20 @@
|
1
|
1
|
package com.reactnativenavigation.viewcontrollers.bottomtabs;
|
2
|
2
|
|
|
3
|
+import android.view.ViewGroup;
|
|
4
|
+
|
3
|
5
|
import com.reactnativenavigation.BaseTest;
|
|
6
|
+import com.reactnativenavigation.parse.Options;
|
|
7
|
+import com.reactnativenavigation.parse.TabsAttachMode;
|
4
|
8
|
import com.reactnativenavigation.presentation.BottomTabsPresenter;
|
5
|
|
-import com.reactnativenavigation.viewcontrollers.*;
|
|
9
|
+import com.reactnativenavigation.viewcontrollers.ViewController;
|
6
|
10
|
|
7
|
11
|
import org.junit.Test;
|
8
|
12
|
import org.mockito.Mockito;
|
9
|
13
|
|
10
|
|
-import java.util.Collections;
|
|
14
|
+import java.util.Arrays;
|
|
15
|
+import java.util.List;
|
11
|
16
|
|
|
17
|
+import static org.assertj.core.api.Java6Assertions.assertThat;
|
12
|
18
|
import static org.mockito.Mockito.mock;
|
13
|
19
|
import static org.mockito.Mockito.verify;
|
14
|
20
|
|
|
@@ -16,14 +22,24 @@ public class BottomTabsAttacherTest extends BaseTest {
|
16
|
22
|
|
17
|
23
|
private BottomTabsAttacher uut;
|
18
|
24
|
private AttachMode mode;
|
|
25
|
+ private Options defaultOptions = new Options();
|
|
26
|
+ private List<ViewController> tabs;
|
19
|
27
|
|
20
|
28
|
@Override
|
21
|
29
|
public void beforeEach() {
|
22
|
30
|
mode = Mockito.mock(AttachMode.class);
|
23
|
|
- uut = new BottomTabsAttacher(Collections.EMPTY_LIST, Mockito.mock(BottomTabsPresenter.class));
|
|
31
|
+ tabs = Arrays.asList(mock(ViewController.class), mock(ViewController.class));
|
|
32
|
+ uut = new BottomTabsAttacher(tabs, Mockito.mock(BottomTabsPresenter.class), defaultOptions);
|
24
|
33
|
uut.attachStrategy = mode;
|
25
|
34
|
}
|
26
|
35
|
|
|
36
|
+ @Test
|
|
37
|
+ public void init_defaultOptionsAreTakenIntoAccount() {
|
|
38
|
+ defaultOptions.bottomTabsOptions.tabsAttachMode = TabsAttachMode.ON_SWITCH_TO_TAB;
|
|
39
|
+ uut.init(Mockito.mock(ViewGroup.class), Options.EMPTY);
|
|
40
|
+ assertThat(uut.attachStrategy).isInstanceOfAny(OnSwitchToTab.class);
|
|
41
|
+ }
|
|
42
|
+
|
27
|
43
|
@Test
|
28
|
44
|
public void attach_delegatesToStrategy() {
|
29
|
45
|
uut.attach();
|