use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalPresenterTest method showModal_rejectIfContentIsNull.
@Test
public void showModal_rejectIfContentIsNull() {
uut.setModalsLayout(null);
CommandListenerAdapter listener = Mockito.mock(CommandListenerAdapter.class);
uut.showModal(modal1, modal2, listener);
verify(listener).onError(any());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalPresenterTest method dismissModal_animatesByDefault.
@Test
public void dismissModal_animatesByDefault() {
disableShowModalAnimation(modal1);
uut.showModal(modal1, root, new CommandListenerAdapter());
uut.dismissModal(modal1, root, root, new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
post(() -> {
verify(modal1).onViewDisappear();
verify(modal1).destroy();
});
}
});
verify(animator).dismiss(eq(root), eq(modal1), any(), any());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalPresenterTest method dismissModal_previousControllerIsNotAddedIfDismissedModalIsNotTop.
@Test
public void dismissModal_previousControllerIsNotAddedIfDismissedModalIsNotTop() {
disableShowModalAnimation(modal1, modal2);
disableDismissModalAnimation(modal1, modal2);
uut.showModal(modal1, root, new CommandListenerAdapter());
uut.showModal(modal2, modal1, new CommandListenerAdapter());
idleMainLooper();
assertThat(modal1.getView().getParent()).isNull();
assertThat(root.getView().getParent()).isNull();
uut.dismissModal(modal1, null, root, new CommandListenerAdapter());
assertThat(root.getView().getParent()).isNull();
uut.dismissModal(modal2, root, root, new CommandListenerAdapter());
assertThat(root.getView().getParent()).isNotNull();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalPresenterTest method dismissModal_previousModalIsAddedBackToHierarchy.
@Test
public void dismissModal_previousModalIsAddedBackToHierarchy() {
disableShowModalAnimation(modal1, modal2);
uut.showModal(modal1, root, new CommandListenerAdapter());
idleMainLooper();
assertThat(modal1.getView().getParent()).isNotNull();
verify(modal1).onViewWillAppear();
uut.showModal(modal2, modal1, new CommandListenerAdapter());
idleMainLooper();
assertThat(modal1.getView().getParent()).isNull();
Shadows.shadowOf(Looper.getMainLooper()).idle();
uut.dismissModal(modal2, modal1, root, new CommandListenerAdapter());
assertThat(modal1.getView().getParent()).isNotNull();
idleMainLooper();
verify(modal1, times(2)).onViewWillAppear();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalPresenterTest method showModal_onViewDidAppearIsInvokedBeforeViewDisappear.
@Test
public void showModal_onViewDidAppearIsInvokedBeforeViewDisappear() {
disableShowModalAnimation(modal1);
root.onViewWillAppear();
uut.showModal(modal1, root, new CommandListenerAdapter());
idleMainLooper();
InOrder inOrder = inOrder(modal1, root);
inOrder.verify(modal1).onViewDidAppear();
inOrder.verify(root).onViewDisappear();
}
Aggregations