|
@@ -47,6 +47,7 @@ public class BottomTabsControllerTest extends BaseTest {
|
47
|
47
|
|
48
|
48
|
private Activity activity;
|
49
|
49
|
private BottomTabsController uut;
|
|
50
|
+ private Options initialOptions = new Options();
|
50
|
51
|
private ViewController child1;
|
51
|
52
|
private ViewController child2;
|
52
|
53
|
private ViewController child3;
|
|
@@ -258,6 +259,20 @@ public class BottomTabsControllerTest extends BaseTest {
|
258
|
259
|
.isEqualTo(((ViewGroup.MarginLayoutParams) child6.getView().getLayoutParams()).topMargin);
|
259
|
260
|
}
|
260
|
261
|
|
|
262
|
+ @Test
|
|
263
|
+ public void oneTimeOptionsAreAppliedOnce() {
|
|
264
|
+ initialOptions.bottomTabsOptions.currentTabIndex = new Number(1);
|
|
265
|
+ BottomTabsController spy = spy(createBottomTabs());
|
|
266
|
+ spy.onViewAppeared();
|
|
267
|
+
|
|
268
|
+ assertThat(spy.getSelectedIndex()).isOne();
|
|
269
|
+ spy.selectTab(0);
|
|
270
|
+ tabs.get(0).onViewAppeared();
|
|
271
|
+ verify(spy).clearOptions();
|
|
272
|
+ assertThat(spy.getSelectedIndex()).isZero();
|
|
273
|
+ assertThat(spy.options.bottomTabsOptions.currentTabIndex.hasValue()).isFalse();
|
|
274
|
+ }
|
|
275
|
+
|
261
|
276
|
@NonNull
|
262
|
277
|
private List<ViewController> createTabs() {
|
263
|
278
|
return Arrays.asList(child1, child2, child3, child4, child5);
|
|
@@ -282,7 +297,7 @@ public class BottomTabsControllerTest extends BaseTest {
|
282
|
297
|
eventEmitter,
|
283
|
298
|
imageLoaderMock,
|
284
|
299
|
"uut",
|
285
|
|
- new Options(),
|
|
300
|
+ initialOptions,
|
286
|
301
|
new OptionsPresenter(activity, new Options()),
|
287
|
302
|
presenter,
|
288
|
303
|
new BottomTabOptionsPresenter(activity, tabs, new Options())) {
|