use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method handleBack_modalTakePrecedenceOverRoot.
@Test
public void handleBack_modalTakePrecedenceOverRoot() {
ViewController<?> root = spy(child1);
uut.setRoot(root, new CommandListenerAdapter(), reactInstanceManager);
uut.showModal(child2, new CommandListenerAdapter());
verify(root, times(0)).handleBack(new CommandListenerAdapter());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method mergeOptions_CallsApplyNavigationOptions.
@Test
public void mergeOptions_CallsApplyNavigationOptions() {
ComponentViewController componentVc = new SimpleComponentViewController(activity, childRegistry, "theId", new Options());
componentVc.setParentController(parentController);
assertThat(componentVc.options.topBar.title.text.get("")).isEmpty();
uut.setRoot(componentVc, new CommandListenerAdapter(), reactInstanceManager);
Options options = new Options();
options.topBar.title.text = new Text("new title");
uut.mergeOptions("theId", options);
assertThat(componentVc.options.topBar.title.text.get()).isEqualTo("new title");
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method pop_InvalidDoesNothing.
@Test
public void pop_InvalidDoesNothing() {
uut.pop("123", Options.EMPTY, new CommandListenerAdapter());
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.pop(child1.getId(), Options.EMPTY, new CommandListenerAdapter());
assertThat(uut.getChildControllers()).hasSize(1);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method setRoot_destroysModals.
@Test
public void setRoot_destroysModals() {
uut.showModal(child1, new CommandListenerAdapter());
uut.setRoot(child2, new CommandListenerAdapter(), reactInstanceManager);
assertTrue(child1.isDestroyed());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldCallRootOnViewDisappearWhenModalDisplayedOverContext.
@Test
public void shouldCallRootOnViewDisappearWhenModalDisplayedOverContext() {
SimpleViewController child1 = spy(this.child1);
final Options overContextOptions = tabOptions.copy();
overContextOptions.modal = new ModalOptions();
overContextOptions.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
ViewController<?> overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal", overContextOptions));
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.showModal(overContextModal, new CommandListenerAdapter());
uut.onHostPause();
verify(child1, times(1)).onViewDisappear();
verify(overContextModal, times(1)).onViewDisappear();
}
Aggregations