Search in sources :

Example 26 with CommandListenerAdapter

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

the class NavigatorTest method pop_InvalidDoesNothing_Promise.

@Test
public void pop_InvalidDoesNothing_Promise() {
    uut.pop("123", Options.EMPTY, new CommandListenerAdapter());
    uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
    uut.pop(child1.getId(), Options.EMPTY, new CommandListenerAdapter() {

        @Override
        public void onError(String reason) {
            assertThat(uut.getChildControllers()).hasSize(1);
        }
    });
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 27 with CommandListenerAdapter

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

the class NavigatorTest method setStackRoot.

@Test
public void setStackRoot() {
    disablePushAnimation(child1, child2, child3);
    StackController stack = newStack(child1, child2);
    uut.setRoot(stack, new CommandListenerAdapter(), reactInstanceManager);
    stack.setRoot(Collections.singletonList(child3), new CommandListenerAdapter());
    assertThat(stack.getChildControllers()).containsOnly(child3);
}
Also used : StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 28 with CommandListenerAdapter

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

the class NavigatorTest method handleBack_falseIfRootIsNotSetAndSingleModalIsDisplayed.

@Test
public void handleBack_falseIfRootIsNotSetAndSingleModalIsDisplayed() {
    disableShowModalAnimation(child1, child2, child3);
    uut.showModal(child1, new CommandListenerAdapter());
    uut.showModal(child2, new CommandListenerAdapter());
    assertThat(uut.handleBack(new CommandListenerAdapter())).isTrue();
    assertThat(uut.handleBack(new CommandListenerAdapter())).isFalse();
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 29 with CommandListenerAdapter

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

the class NavigatorTest method setRoot_AddsChildControllerView.

@Test
public void setRoot_AddsChildControllerView() {
    uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
    assertIsChild(uut.getRootLayout(), child1.getView());
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 30 with CommandListenerAdapter

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

the class NavigatorTest method destroy_destroyOverlayManager.

@Test
public void destroy_destroyOverlayManager() {
    uut.setRoot(parentController, new CommandListenerAdapter(), reactInstanceManager);
    activityController.destroy();
    verify(overlayManager).destroy(uut.getOverlaysLayout());
}
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