use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method destroy_shouldNotChangeViewIds.
@Test
public void destroy_shouldNotChangeViewIds() {
disablePushAnimation(child1);
disableShowModalAnimation(child1, child2, child3);
StackController spy = spy(parentController);
SimpleViewController.SimpleView view = child1.getView();
ViewGroup view1 = child2.getView();
view.setId(10);
view1.setId(11);
spy.options.animations.setRoot.getEnter().enabled = new Bool(false);
uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
spy.push(child1, new CommandListenerAdapter());
uut.showModal(child2, new CommandListenerAdapter());
activityController.destroy();
assertThat(view.getId()).isEqualTo(10);
assertThat(view1.getId()).isEqualTo(11);
verify(spy, times(1)).destroy();
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method pushedStackCanBePopped.
@Test
public void pushedStackCanBePopped() {
StackController spy = spy(parentController);
disablePushAnimation(spy, child2);
spy.push(child2, new CommandListenerAdapter());
StackController parent = newStack(spy);
parent.options.animations.setRoot.getEnter().enabled = new Bool(false);
uut.setRoot(parent, new CommandListenerAdapter(), reactInstanceManager);
CommandListenerAdapter listener = new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
assertThat(spy.getChildControllers().size()).isEqualTo(1);
}
};
disablePopAnimation(child2);
uut.pop("child2", Options.EMPTY, listener);
verify(spy, times(1)).pop(Options.EMPTY, listener);
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method setStackRoot.
@Test
public void setStackRoot() {
disablePushAnimation(child1, child2, child3);
StackController stack = newStack(child1, child2);
uut.setRoot(stack, new CommandListenerAdapter(), reactInstanceManager);
stack.setRoot(Collections.singletonList(child3), new CommandListenerAdapter());
assertThat(stack.getChildControllers()).containsOnly(child3);
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method pop_FromCorrectStackByFindingChildId.
@Test
public void pop_FromCorrectStackByFindingChildId() {
StackController stack1 = newStack(child1);
StackController stack2 = newStack(child2);
BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
stack2.push(child3, new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
stack2.push(child4, new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
uut.pop("child4", Options.EMPTY, new CommandListenerAdapter());
assertThat(stack2.getChildControllers()).containsOnly(child2, child3);
}
});
}
});
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method push_OnCorrectStackByFindingChildId.
@Test
public void push_OnCorrectStackByFindingChildId() {
StackController stack1 = newStack();
stack1.ensureViewIsCreated();
StackController stack2 = newStack();
stack2.ensureViewIsCreated();
stack1.push(child1, new CommandListenerAdapter());
stack2.push(child2, new CommandListenerAdapter());
BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
SimpleViewController newChild = new SimpleViewController(activity, childRegistry, "new child", tabOptions);
uut.push(child2.getId(), newChild, new CommandListenerAdapter());
assertThat(stack1.getChildControllers()).doesNotContain(newChild);
assertThat(stack2.getChildControllers()).contains(newChild);
}
Aggregations