use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalPresenterTest method dismissModal_successIsReportedBeforeViewIsDestroyed.
@Test
public void dismissModal_successIsReportedBeforeViewIsDestroyed() {
disableModalAnimations(modal1);
CommandListenerAdapter listener = Mockito.mock(CommandListenerAdapter.class);
ViewController<?> modal = spy(modal1);
InOrder inOrder = inOrder(listener, modal);
uut.showModal(modal, root, new CommandListenerAdapter());
uut.dismissModal(modal, root, root, listener);
inOrder.verify(listener).onSuccess(modal.getId());
inOrder.verify(modal).destroy();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class ModalPresenterTest method showModal_waitForRender.
@Test
public void showModal_waitForRender() {
modal1.options.animations.showModal.setWaitForRender(new Bool(true));
uut.showModal(modal1, root, new CommandListenerAdapter());
verify(modal1).addOnAppearedListener(any());
verifyNoInteractions(animator);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method setRoot_withWaitForRender.
@Test
public void setRoot_withWaitForRender() {
ViewController<?> initialRoot = spy(child2);
uut.setRoot(initialRoot, new CommandListenerAdapter(), reactInstanceManager);
child3.options.animations.setRoot.getEnter().waitForRender = new Bool(true);
ViewController<?> secondRoot = spy(child3);
CommandListenerAdapter listener = spy(new CommandListenerAdapter());
uut.setRoot(secondRoot, listener, reactInstanceManager);
verify(secondRoot).addOnAppearedListener(any());
// make isRendered return true and trigger onViewAppeared
secondRoot.getView().addView(new View(activity));
idleMainLooper();
assertThat(initialRoot.isDestroyed()).isTrue();
assertThat(secondRoot.isViewShown()).isEqualTo(true);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldCallModalOnViewDisappearWhenModalDisplayedOverContextUnderneath.
@Test
public void shouldCallModalOnViewDisappearWhenModalDisplayedOverContextUnderneath() {
SimpleViewController child1 = spy(this.child1);
ViewController<?> child2 = spy(this.child2);
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.showModal(child2, new CommandListenerAdapter());
uut.onHostPause();
verify(child2, times(1)).onViewDisappear();
verify(overContextModal, never()).onViewDisappear();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldCallOverlaysAndModalsChildrenOnViewDidAppearOnHostResume.
@Test
public void shouldCallOverlaysAndModalsChildrenOnViewDidAppearOnHostResume() {
SimpleViewController child1 = spy(this.child1);
ViewController<?> child2 = spy(this.child2);
ViewController<?> child3 = spy(this.child3);
ViewController<?> child4 = spy(this.child4);
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.showModal(child2, new CommandListenerAdapter());
uut.showOverlay(child3, new CommandListenerAdapter());
uut.showOverlay(child4, new CommandListenerAdapter());
verify(child1, times(1)).onViewDidAppear();
uut.onHostResume();
verify(overlayManager).onHostResume();
verify(child1, times(1)).onViewDidAppear();
verify(child2).onViewDidAppear();
verify(child3).onViewDidAppear();
verify(child4).onViewDidAppear();
}
Aggregations