Search in sources :

Example 46 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class ModalStackTest method showModalWithoutAnimation.

private void showModalWithoutAnimation(ViewController<?> modal) {
    disableShowModalAnimation(modal);
    uut.showModal(modal, root, new CommandListenerAdapter());
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter)

Example 47 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class ModalStackTest method modalRefIsSaved.

@Test
public void modalRefIsSaved() {
    disableShowModalAnimation(modal1);
    CommandListener listener = spy(new CommandListenerAdapter());
    uut.showModal(modal1, root, listener);
    verify(listener, times(1)).onSuccess(modal1.getId());
    assertThat(findModal(MODAL_ID_1)).isNotNull();
}
Also used : CommandListener(com.reactnativenavigation.react.CommandListener) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 48 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class ModalStackTest method dismissModal_listenerAndEmitterAreInvokedWithRootViewControllerId.

@Test
public void dismissModal_listenerAndEmitterAreInvokedWithRootViewControllerId() {
    uut.showModal(stack, root, new CommandListenerAdapter());
    CommandListener listener = spy(new CommandListenerAdapter());
    uut.dismissModal(modal4.getId(), root, listener);
    verify(listener).onSuccess(stack.getId());
    verify(emitter).emitModalDismissed(stack.getId(), modal4.getCurrentComponentName(), 1);
}
Also used : CommandListener(com.reactnativenavigation.react.CommandListener) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 49 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class OverlayManagerTest method dismiss_onViewReturnedToFront.

@Test
public void dismiss_onViewReturnedToFront() {
    uut.show(overlayContainer, overlay1, new CommandListenerAdapter());
    uut.show(overlayContainer, overlay2, new CommandListenerAdapter());
    idleMainLooper();
    verify(overlay1, never()).onViewBroughtToFront();
    uut.dismiss(overlayContainer, OVERLAY_ID_2, new CommandListenerAdapter());
    idleMainLooper();
    verify(overlay1).onViewBroughtToFront();
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 50 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class OverlayManagerTest method dismiss_overlayContainerIsHiddenIfAllOverlaysAreDismissed.

@Test
public void dismiss_overlayContainerIsHiddenIfAllOverlaysAreDismissed() {
    uut.show(overlayContainer, overlay1, new CommandListenerAdapter());
    uut.show(overlayContainer, overlay2, new CommandListenerAdapter());
    uut.dismiss(overlayContainer, OVERLAY_ID_2, new CommandListenerAdapter());
    assertThat(overlayContainer.getVisibility()).isEqualTo(View.VISIBLE);
    assertThat(overlayContainer.getParent()).isEqualTo(contentLayout);
    uut.dismiss(overlayContainer, OVERLAY_ID_1, new CommandListenerAdapter());
    assertThat(overlayContainer.getVisibility()).isEqualTo(View.GONE);
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)121 BaseTest (com.reactnativenavigation.BaseTest)115 Test (org.junit.Test)115 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)22 StackController (com.reactnativenavigation.viewcontrollers.stack.StackController)19 Options (com.reactnativenavigation.options.Options)17 CommandListener (com.reactnativenavigation.react.CommandListener)16 Bool (com.reactnativenavigation.options.params.Bool)7 ModalOptions (com.reactnativenavigation.options.ModalOptions)5 BottomTabsController (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController)5 Text (com.reactnativenavigation.options.params.Text)4 TransitionAnimationOptions (com.reactnativenavigation.options.TransitionAnimationOptions)3 FrameLayout (android.widget.FrameLayout)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 InOrder (org.mockito.InOrder)2 ColorDrawable (android.graphics.drawable.ColorDrawable)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 Nullable (androidx.annotation.Nullable)1 SimpleComponentViewController (com.reactnativenavigation.mocks.SimpleComponentViewController)1