use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method dismissModal_rejectIfRootIsNotSetAndSingleModalIsDisplayed.
@Test
public void dismissModal_rejectIfRootIsNotSetAndSingleModalIsDisplayed() {
disableModalAnimations(child1, child2);
uut.showModal(child1, new CommandListenerAdapter());
uut.showModal(child2, new CommandListenerAdapter());
CommandListenerAdapter listener1 = spy(new CommandListenerAdapter());
uut.dismissModal(child2.getId(), listener1);
verify(listener1).onSuccess(any());
assertThat(child2.isDestroyed()).isTrue();
CommandListenerAdapter listener2 = spy(new CommandListenerAdapter());
uut.dismissModal(child1.getId(), listener2);
verify(listener2).onError(any());
assertThat(child1.isDestroyed()).isFalse();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method destroyViews.
@Test
public void destroyViews() {
uut.setRoot(parentController, new CommandListenerAdapter(), reactInstanceManager);
uut.showModal(child1, new CommandListenerAdapter());
uut.showOverlay(child2, new CommandListenerAdapter());
uut.destroy();
assertThat(childRegistry.size()).isZero();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method shouldNotCallModalOnHostResumeWhenHostResumesAndNoModals.
@Test
public void shouldNotCallModalOnHostResumeWhenHostResumesAndNoModals() {
SimpleViewController child1 = spy(this.child1);
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.onHostResume();
verify(modalStack, never()).onHostResume();
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method onConfigurationChange_shouldCallOnConfigurationChangedForModals.
@Test
public void onConfigurationChange_shouldCallOnConfigurationChangedForModals() {
Navigator spyUUT = spy(uut);
SimpleViewController spyChild1 = spy(child1);
ViewController<?> spyChild2 = spy(child2);
ViewController<?> spyChild3 = spy(child3);
spyUUT.setRoot(spyChild1, new CommandListenerAdapter(), reactInstanceManager);
spyUUT.showModal(spyChild2, new CommandListenerAdapter());
spyUUT.showModal(spyChild3, new CommandListenerAdapter());
spyUUT.onConfigurationChanged(mockConfiguration);
verify(spyChild2).onConfigurationChanged(any());
verify(spyChild3).onConfigurationChanged(any());
}
use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.
the class NavigatorTest method push_InvalidPushWithoutAStack_DoesNothing_Promise.
@Test
public void push_InvalidPushWithoutAStack_DoesNothing_Promise() {
uut.setRoot(child1, new CommandListenerAdapter(), reactInstanceManager);
uut.push(child1.getId(), child2, new CommandListenerAdapter() {
@Override
public void onError(String message) {
assertIsChild(uut.getView(), child1.getView());
}
});
}
Aggregations