|
@@ -4,6 +4,7 @@ import android.app.Activity;
|
4
|
4
|
import android.support.v4.app.FragmentActivity;
|
5
|
5
|
import android.widget.FrameLayout;
|
6
|
6
|
|
|
7
|
+import com.facebook.react.ReactInstanceManager;
|
7
|
8
|
import com.reactnativenavigation.BaseTest;
|
8
|
9
|
import com.reactnativenavigation.parse.ExternalComponent;
|
9
|
10
|
import com.reactnativenavigation.parse.Options;
|
|
@@ -14,6 +15,7 @@ import com.reactnativenavigation.views.ExternalComponentLayout;
|
14
|
15
|
|
15
|
16
|
import org.json.JSONObject;
|
16
|
17
|
import org.junit.Test;
|
|
18
|
+import org.mockito.Mockito;
|
17
|
19
|
|
18
|
20
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
19
|
21
|
import static org.mockito.Mockito.spy;
|
|
@@ -25,16 +27,19 @@ public class ExternalComponentViewControllerTest extends BaseTest {
|
25
|
27
|
private FragmentCreatorMock componentCreator;
|
26
|
28
|
private Activity activity;
|
27
|
29
|
private ExternalComponent ec;
|
|
30
|
+ private ReactInstanceManager reactInstanceManager;
|
28
|
31
|
|
29
|
32
|
@Override
|
30
|
33
|
public void beforeEach() {
|
31
|
34
|
componentCreator = spy(new FragmentCreatorMock());
|
32
|
35
|
activity = newActivity();
|
33
|
36
|
ec = createExternalComponent();
|
|
37
|
+ reactInstanceManager = Mockito.mock(ReactInstanceManager.class);
|
34
|
38
|
uut = spy(new ExternalComponentViewController(activity,
|
35
|
39
|
"fragmentId",
|
36
|
40
|
ec,
|
37
|
41
|
componentCreator,
|
|
42
|
+ reactInstanceManager,
|
38
|
43
|
new Options())
|
39
|
44
|
);
|
40
|
45
|
}
|
|
@@ -55,7 +60,7 @@ public class ExternalComponentViewControllerTest extends BaseTest {
|
55
|
60
|
@Test
|
56
|
61
|
public void createView_createsExternalComponent() throws Exception {
|
57
|
62
|
ExternalComponentLayout view = uut.getView();
|
58
|
|
- verify(componentCreator, times(1)).create((FragmentActivity) activity, ec.passProps);
|
|
63
|
+ verify(componentCreator, times(1)).create((FragmentActivity) activity, reactInstanceManager, ec.passProps);
|
59
|
64
|
assertThat(view.getChildCount()).isGreaterThan(0);
|
60
|
65
|
}
|
61
|
66
|
}
|