use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldCallOverlaysChildrenOnViewDidAppearOnHostResume.
@Test
public void shouldCallOverlaysChildrenOnViewDidAppearOnHostResume() {
SimpleViewController child1 = spy(this.child1);
ViewController<?> child2 = spy(this.child2);
ViewController<?> child3 = spy(this.child3);
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.showOverlay(child2, new CommandListenerAdapter());
uut.showOverlay(child3, new CommandListenerAdapter());
verify(child1, times(1)).onViewDidAppear();
uut.onHostResume();
verify(overlayManager).onHostResume();
verify(child1, times(2)).onViewDidAppear();
verify(child2).onViewDidAppear();
verify(child3).onViewDidAppear();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method destroy_shouldNotChangeViewIds.
@Test
public void destroy_shouldNotChangeViewIds() {
disablePushAnimation(child1);
disableShowModalAnimation(child1, child2, child3);
StackController spy = spy(parentController);
SimpleViewController.SimpleView view = child1.getView();
ViewGroup view1 = child2.getView();
view.setId(10);
view1.setId(11);
spy.options.animations.setRoot.getEnter().enabled = new Bool(false);
uut.setRoot(spy, new CommandListenerAdapter(), reactInstanceManager);
spy.push(child1, new CommandListenerAdapter());
uut.showModal(child2, new CommandListenerAdapter());
activityController.destroy();
assertThat(view.getId()).isEqualTo(10);
assertThat(view1.getId()).isEqualTo(11);
verify(spy, times(1)).destroy();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method handleBack_onViewAppearedInvokedOnRoot.
@Test
public void handleBack_onViewAppearedInvokedOnRoot() {
disableModalAnimations(child1);
disablePushAnimation(child2);
parentController.push(child2, new CommandListenerAdapter());
uut.setRoot(parentController, new CommandListenerAdapter(), reactInstanceManager);
idleMainLooper();
verify(parentVisibilityListener).onViewAppeared(parentController.getView());
uut.showModal(child1, new CommandListenerAdapter());
idleMainLooper();
assertThat(parentController.getView().getParent()).isNull();
verify(parentVisibilityListener).onViewDisappear(parentController.getView());
uut.handleBack(new CommandListenerAdapter());
idleMainLooper();
assertThat(parentController.getView().getParent()).isNotNull();
verify(parentVisibilityListener, times(2)).onViewAppeared(parentController.getView());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method pushedStackCanBePopped.
@Test
public void pushedStackCanBePopped() {
StackController spy = spy(parentController);
disablePushAnimation(spy, child2);
spy.push(child2, new CommandListenerAdapter());
StackController parent = newStack(spy);
parent.options.animations.setRoot.getEnter().enabled = new Bool(false);
uut.setRoot(parent, new CommandListenerAdapter(), reactInstanceManager);
CommandListenerAdapter listener = new CommandListenerAdapter() {
@Override
public void onSuccess(String childId) {
assertThat(spy.getChildControllers().size()).isEqualTo(1);
}
};
disablePopAnimation(child2);
uut.pop("child2", Options.EMPTY, listener);
verify(spy, times(1)).pop(Options.EMPTY, listener);
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method findController_modal.
@Test
public void findController_modal() {
uut.showModal(child1, new CommandListenerAdapter());
assertThat(uut.findController(child1.getId())).isEqualTo(child1);
}
Aggregations