Search in sources :

Example 41 with CommandListenerAdapter

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

the class ModalStackTest method showModal_canShowModalBeforeRootIsSet.

@Test
public void showModal_canShowModalBeforeRootIsSet() {
    CommandListener listener = spy(new CommandListenerAdapter());
    uut.showModal(modal1, null, listener);
    verify(listener).onSuccess(modal1.getId());
}
Also used : CommandListener(com.reactnativenavigation.react.CommandListener) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 42 with CommandListenerAdapter

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

the class ModalStackTest method dismissAllModal_resolvesPromiseSuccessfullyWhenCalledBeforeRootIsSet.

@Test
public void dismissAllModal_resolvesPromiseSuccessfullyWhenCalledBeforeRootIsSet() {
    CommandListenerAdapter spy = spy(new CommandListenerAdapter());
    uut.dismissAllModals(null, Options.EMPTY, spy);
    verify(spy).onSuccess("");
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 43 with CommandListenerAdapter

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

the class ModalStackTest method handleBack_dismissModal.

@Test
public void handleBack_dismissModal() {
    disableDismissModalAnimation(modal1);
    uut.showModal(modal1, root, new CommandListenerAdapter());
    idleMainLooper();
    assertThat(uut.handleBack(new CommandListenerAdapter(), root)).isTrue();
    verify(modal1).onViewDisappear();
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 44 with CommandListenerAdapter

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

the class ModalStackTest method showModal.

@Test
public void showModal() {
    CommandListener listener = spy(new CommandListenerAdapter());
    uut.showModal(modal1, root, listener);
    idleMainLooper();
    verify(listener).onSuccess(modal1.getId());
    verify(modal1).onViewDidAppear();
    assertThat(uut.size()).isOne();
    verify(presenter).showModal(eq(modal1), eq(root), any());
    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 45 with CommandListenerAdapter

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

the class ModalStackTest method dismissAllModals_optionsAreMergedOnTopModal.

@Test
public void dismissAllModals_optionsAreMergedOnTopModal() {
    uut.showModal(modal1, root, new CommandListenerAdapter());
    uut.showModal(modal2, root, new CommandListenerAdapter());
    uut.showModal(modal3, root, new CommandListenerAdapter());
    Options mergeOptions = new Options();
    uut.dismissAllModals(root, mergeOptions, new CommandListenerAdapter());
    verify(modal3).mergeOptions(mergeOptions);
    verify(modal1, times(0)).mergeOptions(mergeOptions);
    verify(modal2, times(0)).mergeOptions(mergeOptions);
}
Also used : TransitionAnimationOptions(com.reactnativenavigation.options.TransitionAnimationOptions) Options(com.reactnativenavigation.options.Options) 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