use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class ParentControllerTest method findControllerById_Recursive.
@Test
public void findControllerById_Recursive() {
StackController stackController = TestUtils.newStackController(activity).build();
stackController.ensureViewIsCreated();
SimpleViewController child1 = new SimpleViewController(activity, childRegistry, "child1", new Options());
SimpleViewController child2 = new SimpleViewController(activity, childRegistry, "child2", new Options());
stackController.push(child1, new CommandListenerAdapter());
stackController.push(child2, new CommandListenerAdapter());
children.add(stackController);
assertThat(uut.findController("child2")).isEqualTo(child2);
}
use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class BackButtonHelperTest method beforeEach.
@Override
public void beforeEach() {
uut = new BackButtonHelper();
Activity activity = newActivity();
ChildControllersRegistry childRegistry = new ChildControllersRegistry();
stack = TestUtils.newStackController(activity).setChildRegistry(childRegistry).setBackButtonHelper(uut).build();
child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
child2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
stack.ensureViewIsCreated();
}
use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class TopTabsViewControllerTest method applyOptions_tabsAreRemovedAfterViewDisappears.
@Test
public void applyOptions_tabsAreRemovedAfterViewDisappears() {
StackController stackController = TestUtils.newStackController(activity).build();
stackController.ensureViewIsCreated();
ViewController<?> first = new SimpleViewController(activity, childRegistry, "first", Options.EMPTY);
disablePushAnimation(first, uut);
stackController.push(first, new CommandListenerAdapter());
stackController.push(uut, new CommandListenerAdapter());
uut.onViewWillAppear();
assertThat(ViewHelper.isVisible(stackController.getTopBar().getTopTabs())).isTrue();
disablePopAnimation(uut);
stackController.pop(Options.EMPTY, new CommandListenerAdapter());
first.onViewWillAppear();
assertThat(ViewHelper.isVisible(stackController.getTopBar().getTopTabs())).isFalse();
}
use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class NavigatorTest method shouldCallOverlaysOnHostResumeWhenHostResumes.
@Test
public void shouldCallOverlaysOnHostResumeWhenHostResumes() {
SimpleViewController child1 = spy(this.child1);
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.onHostResume();
verify(overlayManager).onHostResume();
}
use of com.reactnativenavigation.mocks.SimpleViewController in project react-native-navigation by wix.
the class NavigatorTest method onConfigurationChange_shouldCallOnConfigurationChangedForOverlays.
@Test
public void onConfigurationChange_shouldCallOnConfigurationChangedForOverlays() {
Navigator spyUUT = spy(uut);
SimpleViewController spyChild1 = spy(child1);
ViewController<?> spyChild2 = spy(child2);
ViewController<?> spyChild3 = spy(child3);
spyUUT.setRoot(spyChild1, new CommandListenerAdapter(), reactInstanceManager);
spyUUT.showOverlay(spyChild2, new CommandListenerAdapter());
spyUUT.showOverlay(spyChild3, new CommandListenerAdapter());
spyUUT.onConfigurationChanged(mockConfiguration);
verify(spyChild2).onConfigurationChanged(any());
verify(spyChild3).onConfigurationChanged(any());
}
Aggregations