Search in sources :

Example 11 with Bool

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

the class NavigatorTest method destroy_shouldNotChangeViewIds.

@Test
public void destroy_shouldNotChangeViewIds() {
    disablePushAnimation(child1);
    disableShowModalAnimation(child1, child2, child3);
    StackController spy = spy(parentController);
    SimpleViewController.SimpleView view = child1.getView();
    ViewGroup view1 = child2.getView();
    view.setId(10);
    view1.setId(11);
    spy.options.animations.setRoot.getEnter().enabled = new Bool(false);
    uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
    spy.push(child1, new CommandListenerAdapter());
    uut.showModal(child2, new CommandListenerAdapter());
    activityController.destroy();
    assertThat(view.getId()).isEqualTo(10);
    assertThat(view1.getId()).isEqualTo(11);
    verify(spy, times(1)).destroy();
}
Also used : Bool(com.reactnativenavigation.options.params.Bool) StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) ViewGroup(android.view.ViewGroup) SimpleViewController(com.reactnativenavigation.mocks.SimpleViewController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 12 with Bool

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

the class NavigatorTest method pushedStackCanBePopped.

@Test
public void pushedStackCanBePopped() {
    StackController spy = spy(parentController);
    disablePushAnimation(spy, child2);
    spy.push(child2, new CommandListenerAdapter());
    StackController parent = newStack(spy);
    parent.options.animations.setRoot.getEnter().enabled = new Bool(false);
    uut.setRoot(parent, new CommandListenerAdapter(), reactInstanceManager);
    CommandListenerAdapter listener = new CommandListenerAdapter() {

        @Override
        public void onSuccess(String childId) {
            assertThat(spy.getChildControllers().size()).isEqualTo(1);
        }
    };
    disablePopAnimation(child2);
    uut.pop("child2", Options.EMPTY, listener);
    verify(spy, times(1)).pop(Options.EMPTY, listener);
}
Also used : Bool(com.reactnativenavigation.options.params.Bool) StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 13 with Bool

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

the class SideMenuControllerTest method openLeftMenu.

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

Example 14 with Bool

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

the class SideMenuControllerTest method mergeChildOptions_lockModeIsUpdatedInInitialOptions.

@Test
public void mergeChildOptions_lockModeIsUpdatedInInitialOptions() {
    setLeftRight(left, right);
    Options leftDisabled = new Options();
    leftDisabled.sideMenuRootOptions.left.enabled = new Bool(false);
    left.mergeOptions(leftDisabled);
    assertThat(uut.resolveCurrentOptions().sideMenuRootOptions.left.enabled.get()).isFalse();
    Options rightVisible = new Options();
    rightVisible.sideMenuRootOptions.right.visible = new Bool(true);
    right.mergeOptions(rightVisible);
    assertThat(uut.resolveCurrentOptions().sideMenuRootOptions.left.enabled.get()).isFalse();
}
Also used : SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) Options(com.reactnativenavigation.options.Options) Bool(com.reactnativenavigation.options.params.Bool) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 15 with Bool

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

the class SideMenuControllerTest method createSideMenuOptions.

@NotNull
private Options createSideMenuOptions() {
    Options options = new Options();
    options.sideMenuRootOptions.left.animate = new Bool(false);
    options.sideMenuRootOptions.right.animate = new Bool(false);
    return options;
}
Also used : SideMenuOptions(com.reactnativenavigation.options.SideMenuOptions) Options(com.reactnativenavigation.options.Options) Bool(com.reactnativenavigation.options.params.Bool) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

Bool (com.reactnativenavigation.options.params.Bool)40 BaseTest (com.reactnativenavigation.BaseTest)29 Test (org.junit.Test)29 Options (com.reactnativenavigation.options.Options)14 SideMenuOptions (com.reactnativenavigation.options.SideMenuOptions)10 CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)7 Colour (com.reactnativenavigation.options.params.Colour)6 Text (com.reactnativenavigation.options.params.Text)6 ThemeColour (com.reactnativenavigation.options.params.ThemeColour)6 MenuItem (android.view.MenuItem)5 PorterDuffColorFilter (android.graphics.PorterDuffColorFilter)4 Drawable (android.graphics.drawable.Drawable)4 NullBool (com.reactnativenavigation.options.params.NullBool)4 IconBackgroundDrawable (com.reactnativenavigation.views.stack.topbar.titlebar.IconBackgroundDrawable)4 ViewGroup (android.view.ViewGroup)3 StackController (com.reactnativenavigation.viewcontrollers.stack.StackController)3 SimpleComponentViewController (com.reactnativenavigation.mocks.SimpleComponentViewController)2 IconBackgroundOptions (com.reactnativenavigation.options.IconBackgroundOptions)2 View (android.view.View)1 FrameLayout (android.widget.FrameLayout)1