use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method popTo_FromCorrectStackUpToChild.
@Test
public void popTo_FromCorrectStackUpToChild() {
disablePushAnimation(child5);
StackController stack1 = newStack(child1);
StackController stack2 = newStack(child2, child3, child4);
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.popTo(child2.getId(), Options.EMPTY, new CommandListenerAdapter());
assertThat(stack2.getChildControllers()).containsOnly(child2);
}
});
stack2.push(child5, listener);
verify(listener).onSuccess(child5.getId());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method findController_root.
@Test
public void findController_root() {
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
assertThat(uut.findController(child1.getId())).isEqualTo(child1);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method setDefaultOptions.
@Test
public void setDefaultOptions() {
uut.setDefaultOptions(new Options());
SimpleViewController spy = spy(child1);
uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
Options defaultOptions = new Options();
uut.setDefaultOptions(defaultOptions);
verify(spy).setDefaultOptions(defaultOptions);
verify(modalStack).setDefaultOptions(defaultOptions);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldNotCallModalOnHostPauseWhenHostPausesAndNoModals.
@Test
public void shouldNotCallModalOnHostPauseWhenHostPausesAndNoModals() {
SimpleViewController child1 = spy(this.child1);
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.onHostPause();
verify(modalStack, never()).onHostPause();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method handleBack_DelegatesToRoot.
@Test
public void handleBack_DelegatesToRoot() {
assertThat(uut.handleBack(new CommandListenerAdapter())).isFalse();
ViewController<?> root = spy(child1);
uut.setRoot(root, new CommandListenerAdapter(), reactInstanceManager);
when(root.handleBack(any(CommandListener.class))).thenReturn(true);
assertThat(uut.handleBack(new CommandListenerAdapter())).isTrue();
verify(root, times(1)).handleBack(any());
}
Aggregations