Search in sources :

Example 76 with CommandListenerAdapter

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

the class FloatingActionButtonTest method hasChildren.

@Test
public void hasChildren() {
    childFab = new SimpleViewController(activity, childRegistry, "child1", getOptionsWithFabActions());
    stackController.push(childFab, new CommandListenerAdapter());
    childFab.onViewWillAppear();
    assertThat(hasFab()).isTrue();
    assertThat(containsActions()).isTrue();
}
Also used : SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 77 with CommandListenerAdapter

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

the class FloatingActionButtonTest method showOnPush.

@Test
public void showOnPush() {
    stackController.push(childFab, new CommandListenerAdapter());
    childFab.onViewWillAppear();
    assertThat(hasFab()).isTrue();
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 78 with CommandListenerAdapter

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

the class ModalPresenterTest method showModal_overCurrentContext_previousModalIsNotRemovedFromHierarchy.

@Test
public void showModal_overCurrentContext_previousModalIsNotRemovedFromHierarchy() {
    Options options = new Options();
    options.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
    uut.setDefaultOptions(options);
    disableShowModalAnimation(modal1);
    uut.showModal(modal1, root, new CommandListenerAdapter());
    verify(root, times(0)).detachView();
    verify(root, times(0)).onViewDisappear();
}
Also used : Options(com.reactnativenavigation.options.Options) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 79 with CommandListenerAdapter

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

the class ModalPresenterTest method showModal_noAnimation.

@Test
public void showModal_noAnimation() {
    disableShowModalAnimation(modal1);
    CommandListener listener = spy(new CommandListenerAdapter() {

        @Override
        public void onSuccess(String childId) {
            Shadows.shadowOf(Looper.getMainLooper()).idle();
            assertThat(modal1.getView().getParent()).isEqualTo(modalsLayout);
            verify(modal1).onViewWillAppear();
        }
    });
    uut.showModal(modal1, root, listener);
    verify(animator, never()).show(eq(modal1), eq(root), eq(modal1.options.animations.showModal), any());
    verify(listener).onSuccess(MODAL_ID_1);
}
Also used : CommandListener(com.reactnativenavigation.react.CommandListener) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 80 with CommandListenerAdapter

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

the class ModalPresenterTest method showModal.

@Test
public void showModal() {
    Options defaultOptions = new Options();
    uut.setDefaultOptions(defaultOptions);
    disableShowModalAnimation(modal1);
    uut.showModal(modal1, root, new CommandListenerAdapter());
    verify(modal1).setWaitForRender(any());
    assertThat(modal1.getView().getFitsSystemWindows()).isTrue();
}
Also used : 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