use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method setRoot_delegatesToRootPresenter.
@Test
public void setRoot_delegatesToRootPresenter() {
CommandListenerAdapter listener = new CommandListenerAdapter();
uut.setRoot(child1, listener, reactInstanceManager);
ArgumentCaptor<CommandListenerAdapter> captor = ArgumentCaptor.forClass(CommandListenerAdapter.class);
verify(rootPresenter).setRoot(eq(child1), eq(null), eq(uut.getDefaultOptions()), captor.capture(), eq(reactInstanceManager));
assertThat(captor.getValue().getListener()).isEqualTo(listener);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method pop_byStackId.
@Test
public void pop_byStackId() {
disablePushAnimation(child1, child2);
disablePopAnimation(child2, child1);
StackController stack = newStack(child1, child2);
stack.ensureViewIsCreated();
uut.setRoot(stack, new CommandListenerAdapter(), reactInstanceManager);
uut.pop(stack.getId(), Options.EMPTY, new CommandListenerAdapter());
assertThat(stack.getChildControllers()).containsOnly(child1);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldCallOverlaysOnHostResumeWhenHostResumes.
@Test
public void shouldCallOverlaysOnHostResumeWhenHostResumes() {
SimpleViewController child1 = spy(this.child1);
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.onHostResume();
verify(overlayManager).onHostResume();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method destroy_destroyedRoot.
@Test
public void destroy_destroyedRoot() {
disablePushAnimation(child1);
StackController spy = spy(parentController);
spy.options.animations.setRoot.getEnter().enabled = new Bool(false);
uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
spy.push(child1, new CommandListenerAdapter());
activityController.destroy();
verify(spy, times(1)).destroy();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method pop_FromCorrectStackByFindingChildId_Promise.
@Test
public void pop_FromCorrectStackByFindingChildId_Promise() {
disablePushAnimation(child4);
StackController stack1 = newStack(child1);
final StackController stack2 = newStack(child2, child3);
BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
idleMainLooper();
CommandListenerAdapter listener = spy(new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
uut.pop("child4", Options.EMPTY, new CommandListenerAdapter());
assertThat(stack2.getChildControllers()).containsOnly(child2, child3);
}
});
stack2.push(child4, listener);
verify(listener).onSuccess(child4.getId());
}
Aggregations