Search in sources :

Example 6 with Bool

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

the class PresenterTest method mergeStatusBarVisible_callsShowHide.

@Test
public void mergeStatusBarVisible_callsShowHide() {
    mockSystemUiUtils(1, 1, (mockedStatic) -> {
        ViewGroup spy = spy(new FrameLayout(activity));
        Mockito.when(controller.getView()).thenReturn(spy);
        Mockito.when(controller.resolveCurrentOptions()).thenReturn(Options.EMPTY);
        Options options = new Options();
        options.statusBar.visible = new Bool(false);
        uut.mergeOptions(controller, options);
        mockedStatic.verify(() -> SystemUiUtils.hideStatusBar(any(), eq(spy)), times(1));
        options.statusBar.visible = new Bool(true);
        uut.mergeOptions(controller, options);
        mockedStatic.verify(() -> SystemUiUtils.showStatusBar(any(), eq(spy)), times(1));
    });
}
Also used : Options(com.reactnativenavigation.options.Options) Bool(com.reactnativenavigation.options.params.Bool) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 7 with Bool

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

the class SideMenuPresenterTest method mergeVisibility_visibilityOptionsAreConsumed.

@Test
public void mergeVisibility_visibilityOptionsAreConsumed() {
    SideMenuRootOptions options = new SideMenuRootOptions();
    options.left.visible = new Bool(true);
    options.right.visible = new Bool(true);
    uut.mergeOptions(options);
    assertFalse(options.right.visible.hasValue());
    assertFalse(options.left.visible.hasValue());
}
Also used : SideMenuRootOptions(com.reactnativenavigation.options.SideMenuRootOptions) Bool(com.reactnativenavigation.options.params.Bool) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 8 with Bool

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

the class BackButtonHelperTest method clear.

@Test
public void clear() {
    child1.options.topBar.buttons.back.visible = new Bool(true);
    uut.clear(child1);
    assertThat(child1.options.topBar.buttons.back.visible.get()).isFalse();
}
Also used : Bool(com.reactnativenavigation.options.params.Bool) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 9 with Bool

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

the class TopTabsViewControllerTest method beforeEach.

@Override
public void beforeEach() {
    super.beforeEach();
    activity = newActivity();
    childRegistry = new ChildControllersRegistry();
    List<Options> tabOptions = createOptions();
    tabControllers = createTabsControllers(activity, tabOptions);
    topTabsLayout = spy(new TopTabsViewPager(activity, tabControllers, new TopTabsAdapter(tabControllers)));
    TopTabsLayoutCreator layoutCreator = Mockito.mock(TopTabsLayoutCreator.class);
    Mockito.when(layoutCreator.create()).thenReturn(topTabsLayout);
    Presenter presenter = new Presenter(activity, new Options());
    options.topBar.buttons.back.visible = new Bool(false);
    uut = spy(new TopTabsController(activity, childRegistry, "componentId", tabControllers, layoutCreator, options, presenter));
    tabControllers.forEach(viewController -> viewController.setParentController(uut));
    stack = spy(TestUtils.newStackController(activity).build());
    stack.ensureViewIsCreated();
}
Also used : Options(com.reactnativenavigation.options.Options) TopTabsLayoutCreator(com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator) Bool(com.reactnativenavigation.options.params.Bool) Presenter(com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter) ComponentPresenter(com.reactnativenavigation.viewcontrollers.component.ComponentPresenter) TopTabsViewPager(com.reactnativenavigation.views.toptabs.TopTabsViewPager) ChildControllersRegistry(com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)

Example 10 with Bool

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

the class NavigatorTest method destroy_destroyedRoot.

@Test
public void destroy_destroyedRoot() {
    disablePushAnimation(child1);
    StackController spy = spy(parentController);
    spy.options.animations.setRoot.getEnter().enabled = new Bool(false);
    uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
    spy.push(child1, new CommandListenerAdapter());
    activityController.destroy();
    verify(spy, times(1)).destroy();
}
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)

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