use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class ViewControllerTest method holdsAReferenceToStackControllerOrNull.
@SuppressWarnings("ConstantConditions")
@Test
public void holdsAReferenceToStackControllerOrNull() {
uut.setParentController(null);
assertThat(uut.getParentController()).isNull();
StackController nav = TestUtils.newStackController(activity).build();
nav.ensureViewIsCreated();
nav.push(uut, new CommandListenerAdapter());
assertThat(uut.getParentController()).isEqualTo(nav);
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class NavigatorTest method push.
@Test
public void push() {
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());
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 ParentControllerTest method optionsAreClearedWhenChildIsAppeared.
@Test
public void optionsAreClearedWhenChildIsAppeared() {
StackController stackController = spy(TestUtils.newStackController(activity).build());
stackController.ensureViewIsCreated();
SimpleViewController child1 = new SimpleViewController(activity, childRegistry, "child1", new Options());
stackController.push(child1, new CommandListenerAdapter());
child1.onViewWillAppear();
verify(stackController, times(1)).clearOptions();
}
use of com.reactnativenavigation.viewcontrollers.stack.StackController 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.viewcontrollers.stack.StackController in project react-native-navigation by wix.
the class OptionsApplyingTest method initialOptionsAppliedOnAppear.
@Test
public void initialOptionsAppliedOnAppear() {
uut.options.topBar.title.text = new Text("the title");
StackController stackController = TestUtils.newStackController(activity).build();
stackController.ensureViewIsCreated();
stackController.push(uut, new CommandListenerAdapter());
assertThat(stackController.getTopBar().getTitle()).isEmpty();
uut.onViewWillAppear();
assertThat(stackController.getTopBar().getTitle()).isEqualTo("the title");
}
Aggregations