|
@@ -52,6 +52,7 @@ import static org.mockito.Mockito.mock;
|
52
|
52
|
import static org.mockito.Mockito.spy;
|
53
|
53
|
import static org.mockito.Mockito.times;
|
54
|
54
|
import static org.mockito.Mockito.verify;
|
|
55
|
+import static org.mockito.Mockito.when;
|
55
|
56
|
|
56
|
57
|
public class StackControllerTest extends BaseTest {
|
57
|
58
|
|
|
@@ -762,8 +763,9 @@ public class StackControllerTest extends BaseTest {
|
762
|
763
|
.build());
|
763
|
764
|
Options optionsToMerge = new Options();
|
764
|
765
|
Component component = mock(Component.class);
|
765
|
|
- uut.mergeChildOptions(optionsToMerge, component);
|
766
|
|
- verify(uut, times(1)).mergeChildOptions(optionsToMerge, component);
|
|
766
|
+ ViewController vc = mock(ViewController.class);
|
|
767
|
+ uut.mergeChildOptions(optionsToMerge, vc, component);
|
|
768
|
+ verify(uut, times(1)).mergeChildOptions(optionsToMerge, vc, component);
|
767
|
769
|
}
|
768
|
770
|
|
769
|
771
|
@Test
|
|
@@ -783,10 +785,11 @@ public class StackControllerTest extends BaseTest {
|
783
|
785
|
optionsToMerge.topBar.testId = new Text("topBarID");
|
784
|
786
|
optionsToMerge.bottomTabsOptions.testId = new Text("bottomTabsID");
|
785
|
787
|
Component component = mock(Component.class);
|
786
|
|
- uut.mergeChildOptions(optionsToMerge, component);
|
|
788
|
+ ViewController vc = mock(ViewController.class);
|
|
789
|
+ uut.mergeChildOptions(optionsToMerge, vc, component);
|
787
|
790
|
|
788
|
791
|
ArgumentCaptor<Options> captor = ArgumentCaptor.forClass(Options.class);
|
789
|
|
- verify(parentController, times(1)).mergeChildOptions(captor.capture(), eq(component));
|
|
792
|
+ verify(parentController, times(1)).mergeChildOptions(captor.capture(), eq(vc), eq(component));
|
790
|
793
|
assertThat(captor.getValue().topBar.testId.hasValue()).isFalse();
|
791
|
794
|
assertThat(captor.getValue().bottomTabsOptions.testId.get()).isEqualTo(optionsToMerge.bottomTabsOptions.testId.get());
|
792
|
795
|
}
|
|
@@ -801,16 +804,26 @@ public class StackControllerTest extends BaseTest {
|
801
|
804
|
options.topBar.testId = new Text("id");
|
802
|
805
|
options.fabOptions.id = new Text("fabId");
|
803
|
806
|
Component component = mock(Component.class);
|
|
807
|
+ ViewController vc = mock(ViewController.class);
|
804
|
808
|
|
805
|
809
|
assertThat(options.fabOptions.hasValue()).isTrue();
|
806
|
|
- uut.mergeChildOptions(options, component);
|
|
810
|
+ uut.mergeChildOptions(options, vc, component);
|
807
|
811
|
ArgumentCaptor<Options> captor = ArgumentCaptor.forClass(Options.class);
|
808
|
|
- verify(parentController, times(1)).mergeChildOptions(captor.capture(), eq(component));
|
|
812
|
+ verify(parentController, times(1)).mergeChildOptions(captor.capture(), eq(vc), eq(component));
|
809
|
813
|
assertThat(captor.getValue().animations.push.hasValue()).isFalse();
|
810
|
814
|
assertThat(captor.getValue().topBar.testId.hasValue()).isFalse();
|
811
|
815
|
assertThat(captor.getValue().fabOptions.hasValue()).isFalse();
|
812
|
816
|
}
|
813
|
817
|
|
|
818
|
+ @Test
|
|
819
|
+ public void mergeChildOptions_presenterDoesNotApplyOptionsIfViewIsNotShown() {
|
|
820
|
+ ViewController vc = mock(ViewController.class);
|
|
821
|
+ when(vc.isViewShown()).thenReturn(false);
|
|
822
|
+ Component child = mock(Component.class);
|
|
823
|
+ uut.mergeChildOptions(new Options(), vc, child);
|
|
824
|
+ verify(presenter, times(0)).mergeChildOptions(any(), any(), any());
|
|
825
|
+ }
|
|
826
|
+
|
814
|
827
|
@Test
|
815
|
828
|
public void destroy() {
|
816
|
829
|
uut.ensureViewIsCreated();
|