use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class BackButtonHelperTest method addToChild_addsIfStackContainsMoreThenOneChild.
@Test
public void addToChild_addsIfStackContainsMoreThenOneChild() {
disablePushAnimation(child1, child2);
stack.push(child1, new CommandListenerAdapter());
stack.push(child2, new CommandListenerAdapter());
ArgumentCaptor<Options> optionWithBackButton = ArgumentCaptor.forClass(Options.class);
verify(child2, times(1)).mergeOptions(optionWithBackButton.capture());
assertThat(optionWithBackButton.getValue().topBar.buttons.back.visible.get()).isTrue();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldCallRootOnViewDidAppearWhenModalDisplayedOverContext.
@Test
public void shouldCallRootOnViewDidAppearWhenModalDisplayedOverContext() {
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.onHostResume();
verify(child1, times(2)).onViewDidAppear();
verify(overContextModal, times(1)).onViewDidAppear();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method setRoot_clearsSplashLayout.
@Test
public void setRoot_clearsSplashLayout() {
FrameLayout content = activity.findViewById(android.R.id.content);
// 3 frame layouts (root, modal and overlay containers) and the default splash layout
assertThat(content.getChildCount()).isEqualTo(4);
uut.setRoot(child2, new CommandListenerAdapter(), reactInstanceManager);
assertThat(content.getChildCount()).isEqualTo(3);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method dismissAllModals_onViewAppearedInvokedOnRoot.
@Test
public void dismissAllModals_onViewAppearedInvokedOnRoot() {
disableModalAnimations(child1);
disablePushAnimation(child2);
parentController.push(child2, new CommandListenerAdapter());
uut.setRoot(parentController, new CommandListenerAdapter(), reactInstanceManager);
idleMainLooper();
verify(parentVisibilityListener).onViewAppeared(parentController.getView());
uut.showModal(child1, new CommandListenerAdapter());
idleMainLooper();
assertThat(parentController.getView().getParent()).isNull();
verify(parentVisibilityListener).onViewDisappear(parentController.getView());
uut.dismissAllModals(Options.EMPTY, new CommandListenerAdapter());
idleMainLooper();
assertThat(parentController.getView().getParent()).isNotNull();
verify(parentVisibilityListener, times(2)).onViewAppeared(parentController.getView());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method dismissModal_onViewAppearedInvokedOnRoot.
@Test
public void dismissModal_onViewAppearedInvokedOnRoot() {
disableModalAnimations(child1);
disablePushAnimation(child2);
parentController.push(child2, new CommandListenerAdapter());
uut.setRoot(parentController, new CommandListenerAdapter(), reactInstanceManager);
idleMainLooper();
verify(parentVisibilityListener).onViewAppeared(parentController.getView());
uut.showModal(child1, new CommandListenerAdapter());
idleMainLooper();
assertThat(parentController.getView().getParent()).isNull();
verify(parentVisibilityListener).onViewDisappear(parentController.getView());
uut.dismissModal(child1.getId(), new CommandListenerAdapter());
idleMainLooper();
assertThat(parentController.getView().getParent()).isNotNull();
verify(parentVisibilityListener, times(2)).onViewAppeared(parentController.getView());
}
Aggregations