Search in sources :

Example 1 with CommandListener

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

the class NavigatorTest method push_rejectIfNotContainedInStack.

@Test
public void push_rejectIfNotContainedInStack() {
    CommandListener listener = Mockito.mock(CommandListener.class);
    uut.push("someId", child1, listener);
    verify(listener).onError(any());
}
Also used : CommandListener(com.reactnativenavigation.react.CommandListener) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 2 with CommandListener

use of com.reactnativenavigation.react.CommandListener 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 3 with CommandListener

use of com.reactnativenavigation.react.CommandListener 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 4 with CommandListener

use of com.reactnativenavigation.react.CommandListener 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 5 with CommandListener

use of com.reactnativenavigation.react.CommandListener 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)

Aggregations

CommandListener (com.reactnativenavigation.react.CommandListener)16 BaseTest (com.reactnativenavigation.BaseTest)15 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)15 Test (org.junit.Test)15 Options (com.reactnativenavigation.options.Options)3 TransitionAnimationOptions (com.reactnativenavigation.options.TransitionAnimationOptions)2 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)1 ButtonOptions (com.reactnativenavigation.options.ButtonOptions)1 StackAnimationOptions (com.reactnativenavigation.options.StackAnimationOptions)1 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)1