Search in sources :

Example 86 with Options

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

the class ModalPresenterTest method showModal.

@Test
public void showModal() {
    Options defaultOptions = new Options();
    uut.setDefaultOptions(defaultOptions);
    disableShowModalAnimation(modal1);
    uut.showModal(modal1, root, new CommandListenerAdapter());
    verify(modal1).setWaitForRender(any());
    assertThat(modal1.getView().getFitsSystemWindows()).isTrue();
}
Also used : Options(com.reactnativenavigation.options.Options) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 87 with Options

use of com.reactnativenavigation.options.Options 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 88 with Options

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

the class NavigatorTest method mergeOptions_CallsApplyNavigationOptions.

@Test
public void mergeOptions_CallsApplyNavigationOptions() {
    ComponentViewController componentVc = new SimpleComponentViewController(activity, childRegistry, "theId", new Options());
    componentVc.setParentController(parentController);
    assertThat(componentVc.options.topBar.title.text.get("")).isEmpty();
    uut.setRoot(componentVc, new CommandListenerAdapter(), reactInstanceManager);
    Options options = new Options();
    options.topBar.title.text = new Text("new title");
    uut.mergeOptions("theId", options);
    assertThat(componentVc.options.topBar.title.text.get()).isEqualTo("new title");
}
Also used : ModalOptions(com.reactnativenavigation.options.ModalOptions) Options(com.reactnativenavigation.options.Options) SimpleComponentViewController(com.reactnativenavigation.mocks.SimpleComponentViewController) ComponentViewController(com.reactnativenavigation.viewcontrollers.component.ComponentViewController) Text(com.reactnativenavigation.options.params.Text) SimpleComponentViewController(com.reactnativenavigation.mocks.SimpleComponentViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 89 with Options

use of com.reactnativenavigation.options.Options 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 90 with Options

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

the class NavigatorTest method setDefaultOptions.

@Test
public void setDefaultOptions() {
    uut.setDefaultOptions(new Options());
    SimpleViewController spy = spy(child1);
    uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
    Options defaultOptions = new Options();
    uut.setDefaultOptions(defaultOptions);
    verify(spy).setDefaultOptions(defaultOptions);
    verify(modalStack).setDefaultOptions(defaultOptions);
}
Also used : ModalOptions(com.reactnativenavigation.options.ModalOptions) Options(com.reactnativenavigation.options.Options) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

Options (com.reactnativenavigation.options.Options)110 BaseTest (com.reactnativenavigation.BaseTest)57 Test (org.junit.Test)57 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)32 SideMenuOptions (com.reactnativenavigation.options.SideMenuOptions)19 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)18 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)16 Bool (com.reactnativenavigation.options.params.Bool)15 Text (com.reactnativenavigation.options.params.Text)15 OrientationOptions (com.reactnativenavigation.options.OrientationOptions)10 AnimationOptions (com.reactnativenavigation.options.AnimationOptions)9 ButtonOptions (com.reactnativenavigation.options.ButtonOptions)9 FrameLayout (android.widget.FrameLayout)8 SimpleComponentViewController (com.reactnativenavigation.mocks.SimpleComponentViewController)8 Presenter (com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter)8 ComponentOptions (com.reactnativenavigation.options.ComponentOptions)6 TopBarOptions (com.reactnativenavigation.options.TopBarOptions)6 TopTabOptions (com.reactnativenavigation.options.TopTabOptions)6 TopTabsOptions (com.reactnativenavigation.options.TopTabsOptions)6 Activity (android.app.Activity)5