use of com.reactnativenavigation.viewcontrollers.stack.StackController 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());
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method popToRoot.
@Test
public void popToRoot() {
StackController stack1 = newStack(child1);
StackController stack2 = newStack(child2, child3, child4);
BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
stack2.push(child5, new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
uut.popToRoot(child3.getId(), Options.EMPTY, new CommandListenerAdapter());
assertThat(stack2.getChildControllers()).containsOnly(child2);
}
});
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method newStack.
@NonNull
private StackController newStack(ViewController<?>... children) {
StackController stack = TestUtils.newStackController(activity).setChildren(children).setChildRegistry(childRegistry).setId("stack" + CompatUtils.generateViewId()).setInitialOptions(tabOptions).build();
stack.ensureViewIsCreated();
return stack;
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method push_promise.
@Test
public void push_promise() {
final StackController stackController = newStack();
stackController.push(child1, new CommandListenerAdapter());
uut.setRoot(stackController, new CommandListenerAdapter(), reactInstanceManager);
assertIsChild(uut.getView(), stackController.getView());
assertIsChild(stackController.getView(), child1.getView());
uut.push(child1.getId(), child2, new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
assertIsChild(uut.getView(), stackController.getView());
assertIsChild(stackController.getView(), child2.getView());
}
});
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method pushIntoModal.
@Test
public void pushIntoModal() {
uut.setRoot(parentController, new CommandListenerAdapter(), reactInstanceManager);
StackController stackController = newStack();
stackController.push(child1, new CommandListenerAdapter());
uut.showModal(stackController, new CommandListenerAdapter());
uut.push(stackController.getId(), child2, new CommandListenerAdapter());
assertIsChild(stackController.getView(), child2.getView());
}
Aggregations