|
@@ -30,6 +30,7 @@ import com.reactnativenavigation.viewcontrollers.topbar.TopBarController;
|
30
|
30
|
import com.reactnativenavigation.views.Component;
|
31
|
31
|
import com.reactnativenavigation.views.ReactComponent;
|
32
|
32
|
import com.reactnativenavigation.views.StackLayout;
|
|
33
|
+import com.reactnativenavigation.views.element.ElementTransitionManager;
|
33
|
34
|
import com.reactnativenavigation.views.topbar.TopBar;
|
34
|
35
|
|
35
|
36
|
import org.assertj.core.api.iterable.Extractor;
|
|
@@ -71,9 +72,9 @@ public class StackControllerTest extends BaseTest {
|
71
|
72
|
@Override
|
72
|
73
|
public void beforeEach() {
|
73
|
74
|
super.beforeEach();
|
74
|
|
- animator = Mockito.mock(NavigationAnimator.class);
|
75
|
75
|
backButtonHelper = spy(new BackButtonHelper());
|
76
|
76
|
activity = newActivity();
|
|
77
|
+ animator = spy(new NavigationAnimator(activity, Mockito.mock(ElementTransitionManager.class)));
|
77
|
78
|
childRegistry = new ChildControllersRegistry();
|
78
|
79
|
presenter = spy(new StackOptionsPresenter(activity, new TitleBarReactViewCreatorMock(), new TopBarButtonCreatorMock(), ImageLoaderMock.mock(), new Options()));
|
79
|
80
|
child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
|
|
@@ -168,6 +169,24 @@ public class StackControllerTest extends BaseTest {
|
168
|
169
|
verify(animator, times(0)).push(eq(child1.getView()), eq(child1.options.animations.push), any());
|
169
|
170
|
}
|
170
|
171
|
|
|
172
|
+ @Test
|
|
173
|
+ public void push_backPressedDuringPushAnimationDestroysPushedScreenImmediately() {
|
|
174
|
+ disablePushAnimation(child1);
|
|
175
|
+ uut.push(child1, new CommandListenerAdapter());
|
|
176
|
+
|
|
177
|
+ CommandListenerAdapter pushListener = spy(new CommandListenerAdapter());
|
|
178
|
+ uut.push(child2, pushListener);
|
|
179
|
+ CommandListenerAdapter backListener = spy(new CommandListenerAdapter());
|
|
180
|
+ uut.handleBack(backListener);
|
|
181
|
+ assertThat(uut.size()).isOne();
|
|
182
|
+ assertThat(child1.getView().getParent()).isEqualTo(uut.getView());
|
|
183
|
+ assertThat(child2.isDestroyed()).isTrue();
|
|
184
|
+
|
|
185
|
+ InOrder inOrder = inOrder(pushListener, backListener);
|
|
186
|
+ inOrder.verify(pushListener).onSuccess(any());
|
|
187
|
+ inOrder.verify(backListener).onSuccess(any());
|
|
188
|
+ }
|
|
189
|
+
|
171
|
190
|
@Test
|
172
|
191
|
public void animateSetRoot() {
|
173
|
192
|
disablePushAnimation(child1, child2, child3);
|