Search in sources :

Example 41 with Options

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

the class ComponentViewControllerTest method mergeOptions_delegatesToPresenterIfViewIsNotShown.

@Test
public void mergeOptions_delegatesToPresenterIfViewIsNotShown() {
    Options options = new Options();
    Java6Assertions.assertThat(uut.isViewShown()).isFalse();
    uut.mergeOptions(options);
    Mockito.verifyNoInteractions(presenter);
    Mockito.when(uut.isViewShown()).thenReturn(true);
    uut.mergeOptions(options);
    Mockito.verify(presenter).mergeOptions(uut.getView(), options);
}
Also used : Options(com.reactnativenavigation.options.Options) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 42 with Options

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

the class ComponentViewControllerTest method applyOptions.

@Test
public void applyOptions() {
    Options options = new Options();
    uut.applyOptions(options);
    Mockito.verify(view).applyOptions(options);
    Mockito.verify(presenter).applyOptions(view, resolvedOptions);
}
Also used : Options(com.reactnativenavigation.options.Options) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 43 with Options

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

the class ComponentViewControllerTest method setDefaultOptions.

@Test
public void setDefaultOptions() {
    Options defaultOptions = new Options();
    uut.setDefaultOptions(defaultOptions);
    Mockito.verify(presenter).setDefaultOptions(defaultOptions);
}
Also used : Options(com.reactnativenavigation.options.Options) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 44 with Options

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

the class SideMenuControllerTest method closeLeftMenu.

private void closeLeftMenu() {
    Options options = new Options();
    options.sideMenuRootOptions.left.visible = new Bool(false);
    options.sideMenuRootOptions.left.animate = new Bool(false);
    uut.mergeOptions(options);
    uut.onDrawerSlide(left.getView(), 0);
}
Also used : SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) Options(com.reactnativenavigation.options.Options) Bool(com.reactnativenavigation.options.params.Bool)

Example 45 with Options

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

the class SideMenuControllerTest method setLeftController_matchesParentByDefault.

@Test
public void setLeftController_matchesParentByDefault() {
    SideMenuOptions options = new SideMenuOptions();
    assertThat(options.width.hasValue()).isFalse();
    assertThat(options.height.hasValue()).isFalse();
    uut.options.sideMenuRootOptions.left = options;
    SimpleComponentViewController componentViewController = new SimpleComponentViewController(activity, childRegistry, "left", new Options());
    uut.setLeftController(componentViewController);
    LayoutParams params = componentViewController.getView().getLayoutParams();
    assertThat(params.width).isEqualTo(MATCH_PARENT);
    assertThat(params.height).isEqualTo(MATCH_PARENT);
}
Also used : SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) Options(com.reactnativenavigation.options.Options) LayoutParams(android.view.ViewGroup.LayoutParams) SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) SimpleComponentViewController(com.reactnativenavigation.mocks.SimpleComponentViewController) 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