Search in sources :

Example 16 with CommandListenerAdapter

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

the class NavigatorTest method shouldCallModalPeekDidAppearWhenHostResumes.

@Test
public void shouldCallModalPeekDidAppearWhenHostResumes() {
    SimpleViewController child1 = spy(this.child1);
    ViewController<?> child2 = spy(this.child2);
    uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
    uut.showModal(child2, new CommandListenerAdapter());
    uut.onHostResume();
    verify(modalStack).onHostResume();
    verify(child2).onViewDidAppear();
    verify(child1, times(1)).onViewDidAppear();
}
Also used : SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 17 with CommandListenerAdapter

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

the class NavigatorTest method push_promise.

@Test
public void push_promise() {
    final StackController stackController = newStack();
    stackController.push(child1, new CommandListenerAdapter());
    uut.setRoot(stackController, new CommandListenerAdapter(), reactInstanceManager);
    assertIsChild(uut.getView(), stackController.getView());
    assertIsChild(stackController.getView(), child1.getView());
    uut.push(child1.getId(), child2, new CommandListenerAdapter() {

        @Override
        public void onSuccess(String childId) {
            assertIsChild(uut.getView(), stackController.getView());
            assertIsChild(stackController.getView(), child2.getView());
        }
    });
}
Also used : StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 18 with CommandListenerAdapter

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

the class NavigatorTest method dismissModal_reattachedToRoot.

@Test
public void dismissModal_reattachedToRoot() {
    disableModalAnimations(child1);
    uut.setRoot(parentController, new CommandListenerAdapter(), reactInstanceManager);
    assertThat(ViewUtils.isChildOf(uut.getRootLayout(), parentController.getView())).isTrue();
    uut.showModal(child1, new CommandListenerAdapter());
    uut.dismissModal(child1.getId(), new CommandListenerAdapter());
    assertThat(ViewUtils.isChildOf(uut.getRootLayout(), parentController.getView())).isTrue();
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 19 with CommandListenerAdapter

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

the class NavigatorTest method shouldCallModalPeekDidDisappearWhenHostPauses.

@Test
public void shouldCallModalPeekDidDisappearWhenHostPauses() {
    SimpleViewController child1 = spy(this.child1);
    ViewController<?> child2 = spy(this.child2);
    uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
    uut.showModal(child2, new CommandListenerAdapter());
    uut.onHostPause();
    verify(modalStack).onHostPause();
    verify(child2).onViewDisappear();
}
Also used : SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 20 with CommandListenerAdapter

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

the class NavigatorTest method pushIntoModal.

@Test
public void pushIntoModal() {
    uut.setRoot(parentController, new CommandListenerAdapter(), reactInstanceManager);
    StackController stackController = newStack();
    stackController.push(child1, new CommandListenerAdapter());
    uut.showModal(stackController, new CommandListenerAdapter());
    uut.push(stackController.getId(), child2, new CommandListenerAdapter());
    assertIsChild(stackController.getView(), child2.getView());
}
Also used : StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) 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