Search in sources :

Example 1 with TopTabsViewPager

use of com.reactnativenavigation.views.toptabs.TopTabsViewPager 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 2 with TopTabsViewPager

use of com.reactnativenavigation.views.toptabs.TopTabsViewPager in project react-native-navigation by wix.

the class TopTabsViewControllerTest method componentViewDestroyedOnDestroy.

@Test
public void componentViewDestroyedOnDestroy() {
    uut.ensureViewIsCreated();
    TopTabsViewPager topTabs = uut.getView();
    for (int i = 0; i < SIZE; i++) {
        verify(tab(topTabs, i), times(0)).destroy();
    }
    uut.destroy();
    for (ViewController<?> tabController : tabControllers) {
        verify(tabController, times(1)).destroy();
    }
}
Also used : TopTabsViewPager(com.reactnativenavigation.views.toptabs.TopTabsViewPager) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

TopTabsViewPager (com.reactnativenavigation.views.toptabs.TopTabsViewPager)2 BaseTest (com.reactnativenavigation.BaseTest)1 Options (com.reactnativenavigation.options.Options)1 Bool (com.reactnativenavigation.options.params.Bool)1 ChildControllersRegistry (com.reactnativenavigation.viewcontrollers.child.ChildControllersRegistry)1 ComponentPresenter (com.reactnativenavigation.viewcontrollers.component.ComponentPresenter)1 Presenter (com.reactnativenavigation.viewcontrollers.viewcontroller.Presenter)1 TopTabsLayoutCreator (com.reactnativenavigation.views.toptabs.TopTabsLayoutCreator)1 Test (org.junit.Test)1