use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ViewControllerTest method beforeEach.
@Override
public void beforeEach() {
super.beforeEach();
yellowBoxDelegate = Mockito.mock(YellowBoxDelegate.class);
activity = newActivity();
childRegistry = new ChildControllersRegistry();
uut = new SimpleViewController(activity, childRegistry, "uut", new Options());
mockedParent = Mocks.INSTANCE.parentController(null);
uut.setParentController(mockedParent);
Mockito.when(mockedParent.resolveChildOptions(any())).thenReturn(Options.EMPTY);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ViewControllerTest method onDestroy_RemovesGlobalLayoutListener.
@Test
public void onDestroy_RemovesGlobalLayoutListener() throws Exception {
new SimpleViewController(activity, childRegistry, "ensureNotNull", new Options()).destroy();
ViewController spy = spy(uut);
View view = spy.getView();
Shadows.shadowOf(view).setMyParent(mock(ViewParent.class));
spy.destroy();
Assertions.assertThat(view).isShown();
view.getViewTreeObserver().dispatchOnGlobalLayout();
verify(spy, times(0)).onViewWillAppear();
verify(spy, times(0)).onViewDisappear();
Field field = ViewController.class.getDeclaredField("view");
field.setAccessible(true);
assertThat(field.get(spy)).isNull();
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class ViewControllerTest method canOverrideViewCreation.
@Test
public void canOverrideViewCreation() {
final FrameLayout otherView = new FrameLayout(activity);
yellowBoxDelegate = spy(new YellowBoxDelegate(activity));
ViewController myController = new ViewController(activity, "vc", yellowBoxDelegate, new Options(), new ViewControllerOverlay(activity)) {
@Override
public FrameLayout createView() {
return otherView;
}
@Override
public void sendOnNavigationButtonPressed(String buttonId) {
}
@Override
public String getCurrentComponentName() {
return null;
}
};
assertThat(myController.getView()).isEqualTo(otherView);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class AttachModeTest method beforeEach.
@Override
public void beforeEach() {
activity = newActivity();
childRegistry = new ChildControllersRegistry();
parent = new CoordinatorLayout(activity);
tabs = createTabs();
options = new Options();
options.bottomTabsOptions.currentTabIndex = new Number(INITIAL_TAB);
presenter = Mockito.mock(BottomTabsPresenter.class);
}
use of com.reactnativenavigation.options.Options in project react-native-navigation by wix.
the class AttachModeTest method createTabs.
private List<ViewController<?>> createTabs() {
tab1 = new SimpleViewController(activity, childRegistry, "child1", new Options());
tab2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
ViewController<?> tab3 = new SimpleViewController(activity, childRegistry, "child3", new Options());
return Arrays.asList(tab1, tab2, tab3);
}
Aggregations