Search in sources :

Example 26 with SimpleViewController

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

the class NavigatorTest method shouldNotCallModalOnHostResumeWhenHostResumesAndNoModals.

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

Example 27 with SimpleViewController

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

the class NavigatorTest method onConfigurationChange_shouldCallOnConfigurationChangedForModals.

@Test
public void onConfigurationChange_shouldCallOnConfigurationChangedForModals() {
    Navigator spyUUT = spy(uut);
    SimpleViewController spyChild1 = spy(child1);
    ViewController<?> spyChild2 = spy(child2);
    ViewController<?> spyChild3 = spy(child3);
    spyUUT.setRoot(spyChild1, new CommandListenerAdapter(), reactInstanceManager);
    spyUUT.showModal(spyChild2, new CommandListenerAdapter());
    spyUUT.showModal(spyChild3, new CommandListenerAdapter());
    spyUUT.onConfigurationChanged(mockConfiguration);
    verify(spyChild2).onConfigurationChanged(any());
    verify(spyChild3).onConfigurationChanged(any());
}
Also used : SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 28 with SimpleViewController

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

the class NavigatorTest method shouldCallOnViewDidAppearWhenHostResumes.

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

Example 29 with SimpleViewController

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

the class ParentControllerTest method optionsAreClearedWhenChildIsAppeared.

@Test
public void optionsAreClearedWhenChildIsAppeared() {
    StackController stackController = spy(TestUtils.newStackController(activity).build());
    stackController.ensureViewIsCreated();
    SimpleViewController child1 = new SimpleViewController(activity, childRegistry, "child1", new Options());
    stackController.push(child1, new CommandListenerAdapter());
    child1.onViewWillAppear();
    verify(stackController, times(1)).clearOptions();
}
Also used : Options(com.reactnativenavigation.options.Options) StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 30 with SimpleViewController

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

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