Search in sources :

Example 6 with SimpleComponentViewController

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

the class SideMenuControllerTest method mergeOptions_openRightSideMenu.

@Test
public void mergeOptions_openRightSideMenu() {
    uut.setRightController(new SimpleComponentViewController(activity, childRegistry, "right", new Options()));
    Options options = new Options();
    options.sideMenuRootOptions.right.visible = new Bool(true);
    assertThat(uut.getView().isDrawerOpen(Gravity.RIGHT)).isFalse();
    uut.mergeOptions(options);
    assertThat(uut.getView().isDrawerOpen(Gravity.RIGHT)).isTrue();
}
Also used : SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) Options(com.reactnativenavigation.options.Options) Bool(com.reactnativenavigation.options.params.Bool) SimpleComponentViewController(com.reactnativenavigation.mocks.SimpleComponentViewController) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 7 with SimpleComponentViewController

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

the class SideMenuControllerTest method mergeOptions_openLeftSideMenu.

@Test
public void mergeOptions_openLeftSideMenu() {
    uut.setLeftController(new SimpleComponentViewController(activity, childRegistry, "left", new Options()));
    Options options = new Options();
    options.sideMenuRootOptions.left.visible = new Bool(true);
    assertThat(uut.getView().isDrawerOpen(Gravity.LEFT)).isFalse();
    uut.mergeOptions(options);
    assertThat(uut.getView().isDrawerOpen(Gravity.LEFT)).isTrue();
}
Also used : SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) Options(com.reactnativenavigation.options.Options) Bool(com.reactnativenavigation.options.params.Bool) SimpleComponentViewController(com.reactnativenavigation.mocks.SimpleComponentViewController) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 8 with SimpleComponentViewController

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

Aggregations

SimpleComponentViewController (com.reactnativenavigation.mocks.SimpleComponentViewController)8 Options (com.reactnativenavigation.options.Options)8 BaseTest (com.reactnativenavigation.BaseTest)7 SideMenuOptions (com.reactnativenavigation.options.SideMenuOptions)7 Test (org.junit.Test)7 LayoutParams (android.view.ViewGroup.LayoutParams)4 Bool (com.reactnativenavigation.options.params.Bool)2 Number (com.reactnativenavigation.options.params.Number)2 ModalOptions (com.reactnativenavigation.options.ModalOptions)1 Text (com.reactnativenavigation.options.params.Text)1 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)1 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)1 ComponentViewController (com.reactnativenavigation.viewcontrollers.component.ComponentViewController)1 Presenter (com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter)1