Search in sources :

Example 51 with CommandListenerAdapter

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

the class OverlayManagerTest method dismiss_rejectIfOverlayNotFound.

@Test
public void dismiss_rejectIfOverlayNotFound() {
    CommandListener listener = spy(new CommandListenerAdapter());
    uut.dismiss(overlayContainer, overlay1.getId(), listener);
    verify(listener, times(1)).onError(any());
}
Also used : CommandListener(com.reactnativenavigation.react.CommandListener) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 52 with CommandListenerAdapter

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

the class OverlayManagerTest method show.

@Test
public void show() {
    CommandListenerAdapter listener = spy(new CommandListenerAdapter());
    uut.show(overlayContainer, overlay1, listener);
    idleMainLooper();
    verify(listener).onSuccess(OVERLAY_ID_1);
    verify(overlay1).onViewDidAppear();
    assertThat(overlay1.getView().getParent()).isEqualTo(overlayContainer);
    assertMatchParent(overlay1.getView());
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 53 with CommandListenerAdapter

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

the class ViewControllerTest method holdsAReferenceToStackControllerOrNull.

@SuppressWarnings("ConstantConditions")
@Test
public void holdsAReferenceToStackControllerOrNull() {
    uut.setParentController(null);
    assertThat(uut.getParentController()).isNull();
    StackController nav = TestUtils.newStackController(activity).build();
    nav.ensureViewIsCreated();
    nav.push(uut, new CommandListenerAdapter());
    assertThat(uut.getParentController()).isEqualTo(nav);
}
Also used : StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 54 with CommandListenerAdapter

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

the class SideMenuControllerTest method handleBack_closesRightMenu.

@Test
public void handleBack_closesRightMenu() {
    uut.setRightController(right);
    assertThat(uut.handleBack(new CommandListenerAdapter())).isFalse();
    verify(center, times(1)).handleBack(any());
    openRightMenu();
    assertThat(uut.handleBack(new CommandListenerAdapter())).isTrue();
    verify(center, times(1)).handleBack(any());
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 55 with CommandListenerAdapter

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

the class FloatingActionButtonTest method showOnPop.

@Test
public void showOnPop() {
    disablePushAnimation(childFab, childNoFab);
    stackController.push(childFab, new CommandListenerAdapter());
    stackController.push(childNoFab, new CommandListenerAdapter());
    childNoFab.onViewWillAppear();
    assertThat(hasFab()).isFalse();
    stackController.pop(Options.EMPTY, new CommandListenerAdapter());
    childFab.onViewWillAppear();
    assertThat(hasFab()).isTrue();
}
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