|
@@ -8,12 +8,15 @@ import com.reactnativenavigation.BaseTest;
|
8
|
8
|
import com.reactnativenavigation.mocks.ImageLoaderMock;
|
9
|
9
|
import com.reactnativenavigation.mocks.MockPromise;
|
10
|
10
|
import com.reactnativenavigation.mocks.SimpleViewController;
|
|
11
|
+import com.reactnativenavigation.parse.Color;
|
11
|
12
|
import com.reactnativenavigation.parse.Options;
|
12
|
13
|
import com.reactnativenavigation.utils.ImageLoader;
|
13
|
14
|
import com.reactnativenavigation.utils.OptionHelper;
|
14
|
15
|
import com.reactnativenavigation.views.BottomTabs;
|
|
16
|
+import com.reactnativenavigation.views.ReactComponent;
|
15
|
17
|
|
16
|
18
|
import org.junit.Test;
|
|
19
|
+import org.mockito.ArgumentCaptor;
|
17
|
20
|
|
18
|
21
|
import java.util.Arrays;
|
19
|
22
|
import java.util.Collections;
|
|
@@ -118,6 +121,25 @@ public class BottomTabsControllerTest extends BaseTest {
|
118
|
121
|
verify(spy, times(1)).handleBack();
|
119
|
122
|
}
|
120
|
123
|
|
|
124
|
+ @Test
|
|
125
|
+ public void applyOptions_bottomTabsOptionsAreClearedAfterApply() throws Exception {
|
|
126
|
+ List<ViewController> tabs = createTabs();
|
|
127
|
+ child1.options.bottomTabsOptions.color = new Color(android.graphics.Color.RED);
|
|
128
|
+ uut.setTabs(tabs);
|
|
129
|
+ uut.ensureViewIsCreated();
|
|
130
|
+
|
|
131
|
+ StackController stack = spy(new StackController(activity, "stack", new Options()));
|
|
132
|
+ stack.ensureViewIsCreated();
|
|
133
|
+ stack.push(uut, new MockPromise());
|
|
134
|
+
|
|
135
|
+ child1.onViewAppeared();
|
|
136
|
+ ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
|
|
137
|
+ ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
|
|
138
|
+ verify(stack, times(1)).applyOptions(optionsCaptor.capture(), viewCaptor.capture());
|
|
139
|
+ assertThat(viewCaptor.getValue()).isEqualTo(child1.getView());
|
|
140
|
+ assertThat(optionsCaptor.getValue().bottomTabsOptions.color.hasValue()).isFalse();
|
|
141
|
+ }
|
|
142
|
+
|
121
|
143
|
@NonNull
|
122
|
144
|
private List<ViewController> createTabs() {
|
123
|
145
|
return Arrays.asList(child1, child2, child3, child4, child5);
|