use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class NavigatorTest method setDefaultOptions.
@Test
public void setDefaultOptions() {
uut.setDefaultOptions(new Options());
SimpleViewController spy = spy(child1);
uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
Options defaultOptions = new Options();
uut.setDefaultOptions(defaultOptions);
verify(spy).setDefaultOptions(defaultOptions);
verify(modalStack).setDefaultOptions(defaultOptions);
}
use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class NavigatorTest method shouldNotCallModalOnHostPauseWhenHostPausesAndNoModals.
@Test
public void shouldNotCallModalOnHostPauseWhenHostPausesAndNoModals() {
SimpleViewController child1 = spy(this.child1);
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.onHostPause();
verify(modalStack, never()).onHostPause();
}
use of com.reactnativenavigation.mocks.SimpleViewController 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.mocks.SimpleViewController 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.mocks.SimpleViewController 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