use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class OptionsApplyingTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
initialNavigationOptions = new Options();
view = spy(new TestComponentLayout(activity, new TestReactView(activity)));
view.asView().setLayoutParams(new RelativeLayout.LayoutParams(MATCH_PARENT, MATCH_PARENT));
uut = new ComponentViewController(activity, new ChildControllersRegistry(), "componentId1", "componentName", (activity1, componentId, componentName) -> view, initialNavigationOptions, new Presenter(activity, new Options()), new ComponentPresenter(Options.EMPTY)) {
@Override
public boolean isViewShown() {
return true;
}
};
TopBarController topBarController = new TopBarController() {
@Override
protected TopBar createTopBar(Context context, StackLayout stackLayout) {
topBar = spy(super.createTopBar(context, stackLayout));
return topBar;
}
};
stack = TestUtils.newStackController(activity).setTopBarController(topBarController).build();
stack.ensureViewIsCreated();
stack.getView().layout(0, 0, 1000, 1000);
stack.getTopBar().layout(0, 0, 1000, 100);
activity.setContentView(stack.getView());
disablePushAnimation(uut);
}
use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class SideMenuControllerTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = createActivity();
childRegistry = new ChildControllersRegistry();
presenter = spy(new SideMenuPresenter());
child = new SimpleComponentViewController(activity, childRegistry, "child", new Options());
left = spy(new SimpleComponentViewController(activity, childRegistry, "left", new Options()));
right = spy(new SimpleComponentViewController(activity, childRegistry, "right", createSideMenuOptions()));
center = spy(new SimpleComponentViewController(activity, childRegistry, "center", createSideMenuOptions()));
uut = new SideMenuController(activity, childRegistry, "sideMenu", new Options(), presenter, new Presenter(activity, new Options())) {
@Override
public Options resolveCurrentOptions() {
resolvedOptions = super.resolveCurrentOptions();
return resolvedOptions;
}
};
uut.setCenterController(center);
parent = Mocks.INSTANCE.parentController(null);
Mockito.when(parent.resolveChildOptions(uut)).thenReturn(Options.EMPTY);
uut.setParentController(parent);
}
use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class ComponentViewControllerTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
SystemUiUtils.saveStatusBarHeight(63);
view = Mockito.spy(new TestComponentLayout(activity, new TestReactView(activity)));
parent = TestUtils.newStackController(activity).build();
Presenter presenter = new Presenter(activity, new Options());
this.presenter = Mockito.spy(new ComponentPresenter(Options.EMPTY));
uut = Mockito.spy(new ComponentViewController(activity, new ChildControllersRegistry(), "componentId1", "componentName", (activity1, componentId, componentName) -> view, new Options(), presenter, this.presenter) {
@Override
public Options resolveCurrentOptions(Options defaultOptions) {
// Hacky way to return the same instance of resolvedOptions without copying it.
return resolvedOptions.withDefaultOptions(uut.options).withDefaultOptions(defaultOptions);
}
});
uut.setParentController(parent);
parent.ensureViewIsCreated();
}
use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class ExternalComponentViewControllerTest method beforeEach.
@Override
public void beforeEach() {
componentCreator = spy(new FragmentCreatorMock());
activity = newActivity();
ec = createExternalComponent();
reactInstanceManager = Mockito.mock(ReactInstanceManager.class);
emitter = Mockito.mock(EventEmitter.class);
childRegistry = new ChildControllersRegistry();
uut = spy(new ExternalComponentViewController(activity, childRegistry, "fragmentId", new Presenter(activity, Options.EMPTY), ec, componentCreator, reactInstanceManager, emitter, new ExternalComponentPresenter(), new Options()));
}
use of com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter in project react-native-navigation by wix.
the class TopTabsViewControllerTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
childRegistry = new ChildControllersRegistry();
List<Options> tabOptions = createOptions();
tabControllers = createTabsControllers(activity, tabOptions);
topTabsLayout = spy(new TopTabsViewPager(activity, tabControllers, new TopTabsAdapter(tabControllers)));
TopTabsLayoutCreator layoutCreator = Mockito.mock(TopTabsLayoutCreator.class);
Mockito.when(layoutCreator.create()).thenReturn(topTabsLayout);
Presenter presenter = new Presenter(activity, new Options());
options.topBar.buttons.back.visible = new Bool(false);
uut = spy(new TopTabsController(activity, childRegistry, "componentId", tabControllers, layoutCreator, options, presenter));
tabControllers.forEach(viewController -> viewController.setParentController(uut));
stack = spy(TestUtils.newStackController(activity).build());
stack.ensureViewIsCreated();
}
Aggregations