Search in sources :

Example 6 with SimpleViewController

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

the class NavigatorTest method shouldCallOnViewDisappearWhenHostPauses.

@Test
public void shouldCallOnViewDisappearWhenHostPauses() {
    SimpleViewController child1 = spy(this.child1);
    uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
    uut.onHostPause();
    verify(child1).onViewDidAppear();
}
Also used : SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 7 with SimpleViewController

use of com.reactnativenavigation.mocks.SimpleViewController 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 8 with SimpleViewController

use of com.reactnativenavigation.mocks.SimpleViewController 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 9 with SimpleViewController

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

the class NavigatorTest method shouldCallOverlaysChildrenOnViewDidAppearOnHostResume.

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

Example 10 with SimpleViewController

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

the class NavigatorTest method push_OnCorrectStackByFindingChildId.

@Test
public void push_OnCorrectStackByFindingChildId() {
    StackController stack1 = newStack();
    stack1.ensureViewIsCreated();
    StackController stack2 = newStack();
    stack2.ensureViewIsCreated();
    stack1.push(child1, new CommandListenerAdapter());
    stack2.push(child2, new CommandListenerAdapter());
    BottomTabsController bottomTabsController = newTabs(Arrays.asList(stack1, stack2));
    uut.setRoot(bottomTabsController, new CommandListenerAdapter(), reactInstanceManager);
    SimpleViewController newChild = new SimpleViewController(activity, childRegistry, "new child", tabOptions);
    uut.push(child2.getId(), newChild, new CommandListenerAdapter());
    assertThat(stack1.getChildControllers()).doesNotContain(newChild);
    assertThat(stack2.getChildControllers()).contains(newChild);
}
Also used : BottomTabsController(com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController) StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)42 BaseTest (com.reactnativenavigation.BaseTest)31 Test (org.junit.Test)31 Options (com.reactnativenavigation.options.Options)27 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)21 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)8 Activity (android.app.Activity)4 ModalOptions (com.reactnativenavigation.options.ModalOptions)4 StackController (com.reactnativenavigation.viewcontrollers.stack.StackController)4 FrameLayout (android.widget.FrameLayout)3 View (android.view.View)2 CoordinatorLayout (androidx.coordinatorlayout.widget.CoordinatorLayout)2 TransitionAnimationOptions (com.reactnativenavigation.options.TransitionAnimationOptions)2 Text (com.reactnativenavigation.options.params.Text)2 EventEmitter (com.reactnativenavigation.react.events.EventEmitter)2 ViewParent (android.view.ViewParent)1 ReactInstanceManager (com.facebook.react.ReactInstanceManager)1 TestActivity (com.reactnativenavigation.TestActivity)1 TypefaceLoaderMock (com.reactnativenavigation.mocks.TypefaceLoaderMock)1 FabOptions (com.reactnativenavigation.options.FabOptions)1