use of com.reactnativenavigation.mocks.SimpleViewController 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.mocks.SimpleViewController 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.mocks.SimpleViewController 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();
}
use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class ParentControllerTest method findControllerById_ChildById.
@Test
public void findControllerById_ChildById() {
SimpleViewController child1 = new SimpleViewController(activity, childRegistry, "child1", new Options());
SimpleViewController child2 = new SimpleViewController(activity, childRegistry, "child2", new Options());
children.add(child1);
children.add(child2);
assertThat(uut.findController("uut")).isEqualTo(uut);
assertThat(uut.findController("child1")).isEqualTo(child1);
}
use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class NavigatorTest method shouldCallRootOnViewDidAppearWhenModalDisplayedOverContext.
@Test
public void shouldCallRootOnViewDidAppearWhenModalDisplayedOverContext() {
SimpleViewController child1 = spy(this.child1);
final Options overContextOptions = tabOptions.copy();
overContextOptions.modal = new ModalOptions();
overContextOptions.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
ViewController<?> overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal", overContextOptions));
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.showModal(overContextModal, new CommandListenerAdapter());
uut.onHostResume();
verify(child1, times(2)).onViewDidAppear();
verify(overContextModal, times(1)).onViewDidAppear();
}
Aggregations