use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ParentControllerTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
activity = newActivity();
childRegistry = new ChildControllersRegistry();
children = new ArrayList<>();
Options initialOptions = new Options();
initialOptions.topBar.title.text = new Text(INITIAL_TITLE);
presenter = spy(new Presenter(activity, new Options()));
uut = spy(new ParentController<ViewGroup>(activity, childRegistry, "uut", presenter, initialOptions) {
@Override
public ViewController<?> getCurrentChild() {
return children.get(0);
}
@NonNull
@Override
public ViewGroup createView() {
FrameLayout layout = new FrameLayout(activity);
for (ViewController<?> child : children) {
child.setParentController(this);
layout.addView(child.getView());
}
return layout;
}
@Override
public void sendOnNavigationButtonPressed(String buttonId) {
}
@NonNull
@Override
public Collection<ViewController<?>> getChildControllers() {
return children;
}
});
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ParentControllerTest method destroy_DestroysChildren.
@Test
public void destroy_DestroysChildren() {
ViewController<?> child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
children.add(child1);
verify(child1, times(0)).destroy();
uut.destroy();
verify(child1, times(1)).destroy();
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ParentControllerTest method onViewDidAppearShouldCallCurrentChildDidAppear.
@Test
public void onViewDidAppearShouldCallCurrentChildDidAppear() {
SimpleViewController child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
SimpleViewController child2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
children.add(child1);
children.add(child2);
uut.onViewDidAppear();
verify(child1).onViewDidAppear();
verify(child2, never()).onViewDidAppear();
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ParentControllerTest method onConfigurationChange_shouldCallConfigurationChangeForPresenterAndChildren.
@Test
public void onConfigurationChange_shouldCallConfigurationChangeForPresenterAndChildren() {
children.add(spy(new SimpleViewController(activity, childRegistry, "child1", new Options())));
children.add(spy(new SimpleViewController(activity, childRegistry, "child2", new Options())));
ParentController<?> spyUUT = spy(uut);
spyUUT.onConfigurationChanged(mockConfiguration);
verify(presenter).onConfigurationChanged(any(), any());
for (ViewController<?> controller : children) {
verify(controller).onConfigurationChanged(any());
}
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ParentControllerTest method onViewDisappearShouldCallCurrentChildDisAppear.
@Test
public void onViewDisappearShouldCallCurrentChildDisAppear() {
SimpleViewController child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
SimpleViewController child2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
children.add(child1);
children.add(child2);
uut.onViewDisappear();
verify(child1).onViewDisappear();
verify(child2, never()).onViewDisappear();
}
Aggregations