|
@@ -7,6 +7,7 @@ import com.reactnativenavigation.TestUtils;
|
7
|
7
|
import com.reactnativenavigation.mocks.TestComponentLayout;
|
8
|
8
|
import com.reactnativenavigation.mocks.TestReactView;
|
9
|
9
|
import com.reactnativenavigation.parse.Options;
|
|
10
|
+import com.reactnativenavigation.presentation.ComponentPresenter;
|
10
|
11
|
import com.reactnativenavigation.presentation.Presenter;
|
11
|
12
|
import com.reactnativenavigation.views.StackLayout;
|
12
|
13
|
|
|
@@ -22,6 +23,7 @@ import static org.mockito.Mockito.when;
|
22
|
23
|
public class ComponentViewControllerTest extends BaseTest {
|
23
|
24
|
private ComponentViewController uut;
|
24
|
25
|
private IReactView view;
|
|
26
|
+ private ComponentPresenter componentPresenter;
|
25
|
27
|
|
26
|
28
|
@Override
|
27
|
29
|
public void beforeEach() {
|
|
@@ -30,7 +32,8 @@ public class ComponentViewControllerTest extends BaseTest {
|
30
|
32
|
view = spy(new TestComponentLayout(activity, new TestReactView(activity)));
|
31
|
33
|
ParentController<StackLayout> parentController = TestUtils.newStackController(activity).build();
|
32
|
34
|
Presenter presenter = new Presenter(activity, new Options());
|
33
|
|
- uut = new ComponentViewController(activity, new ChildControllersRegistry(), "componentId1", "componentName", (activity1, componentId, componentName) -> view, new Options(), presenter);
|
|
35
|
+ this.componentPresenter = spy(new ComponentPresenter());
|
|
36
|
+ uut = new ComponentViewController(activity, new ChildControllersRegistry(), "componentId1", "componentName", (activity1, componentId, componentName) -> view, new Options(), presenter, this.componentPresenter);
|
34
|
37
|
uut.setParentController(parentController);
|
35
|
38
|
parentController.ensureViewIsCreated();
|
36
|
39
|
}
|
|
@@ -85,4 +88,11 @@ public class ComponentViewControllerTest extends BaseTest {
|
85
|
88
|
spy.mergeOptions(Options.EMPTY);
|
86
|
89
|
verify(spy, times(0)).performOnParentController(any());
|
87
|
90
|
}
|
|
91
|
+
|
|
92
|
+ @Test
|
|
93
|
+ public void mergeOptions_delegatesToPresenter() {
|
|
94
|
+ Options options = new Options();
|
|
95
|
+ uut.mergeOptions(options);
|
|
96
|
+ verify(componentPresenter).mergeOptions(uut.getView(), options);
|
|
97
|
+ }
|
88
|
98
|
}
|