Search in sources :

Example 1 with ModalOptions

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

the class NavigatorTest method shouldCallModalOnViewDisappearWhenModalDisplayedOverContextUnderneath.

@Test
public void shouldCallModalOnViewDisappearWhenModalDisplayedOverContextUnderneath() {
    SimpleViewController child1 = spy(this.child1);
    ViewController<?> child2 = spy(this.child2);
    final Options overContextOptions = tabOptions.copy();
    overContextOptions.modal = new ModalOptions();
    overContextOptions.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
    ViewController<?> overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal", overContextOptions));
    uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
    uut.showModal(overContextModal, new CommandListenerAdapter());
    uut.showModal(child2, new CommandListenerAdapter());
    uut.onHostPause();
    verify(child2, times(1)).onViewDisappear();
    verify(overContextModal, never()).onViewDisappear();
}
Also used : ModalOptions(com.reactnativenavigation.options.ModalOptions) Options(com.reactnativenavigation.options.Options) ModalOptions(com.reactnativenavigation.options.ModalOptions) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 2 with ModalOptions

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

the class NavigatorTest method shouldCallRootOnViewDisappearWhenModalDisplayedOverContext.

@Test
public void shouldCallRootOnViewDisappearWhenModalDisplayedOverContext() {
    SimpleViewController child1 = spy(this.child1);
    final Options overContextOptions = tabOptions.copy();
    overContextOptions.modal = new ModalOptions();
    overContextOptions.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
    ViewController<?> overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal", overContextOptions));
    uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
    uut.showModal(overContextModal, new CommandListenerAdapter());
    uut.onHostPause();
    verify(child1, times(1)).onViewDisappear();
    verify(overContextModal, times(1)).onViewDisappear();
}
Also used : ModalOptions(com.reactnativenavigation.options.ModalOptions) Options(com.reactnativenavigation.options.Options) ModalOptions(com.reactnativenavigation.options.ModalOptions) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 3 with ModalOptions

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

the class NavigatorTest method shouldCallRootOnViewDidAppearWhenModalDisplayedOverContext.

@Test
public void shouldCallRootOnViewDidAppearWhenModalDisplayedOverContext() {
    SimpleViewController child1 = spy(this.child1);
    final Options overContextOptions = tabOptions.copy();
    overContextOptions.modal = new ModalOptions();
    overContextOptions.modal.presentationStyle = ModalPresentationStyle.OverCurrentContext;
    ViewController<?> overContextModal = spy(new SimpleViewController(activity, childRegistry, "overContextModal", overContextOptions));
    uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
    uut.showModal(overContextModal, new CommandListenerAdapter());
    uut.onHostResume();
    verify(child1, times(2)).onViewDidAppear();
    verify(overContextModal, times(1)).onViewDidAppear();
}
Also used : ModalOptions(com.reactnativenavigation.options.ModalOptions) Options(com.reactnativenavigation.options.Options) ModalOptions(com.reactnativenavigation.options.ModalOptions) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

BaseTest (com.reactnativenavigation.BaseTest)3 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)3 ModalOptions (com.reactnativenavigation.options.ModalOptions)3 Options (com.reactnativenavigation.options.Options)3 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)3 Test (org.junit.Test)3