|
@@ -1,7 +1,6 @@
|
1
|
1
|
package com.reactnativenavigation.viewcontrollers.modal;
|
2
|
2
|
|
3
|
3
|
import android.app.Activity;
|
4
|
|
-import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
5
|
4
|
import android.widget.FrameLayout;
|
6
|
5
|
|
7
|
6
|
import com.reactnativenavigation.BaseTest;
|
|
@@ -20,11 +19,15 @@ import com.reactnativenavigation.viewcontrollers.ViewController;
|
20
|
19
|
import org.json.JSONException;
|
21
|
20
|
import org.json.JSONObject;
|
22
|
21
|
import org.junit.Test;
|
|
22
|
+import org.mockito.InOrder;
|
23
|
23
|
import org.mockito.Mockito;
|
24
|
24
|
|
|
25
|
+import androidx.coordinatorlayout.widget.CoordinatorLayout;
|
|
26
|
+
|
25
|
27
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
26
|
28
|
import static org.mockito.ArgumentMatchers.any;
|
27
|
29
|
import static org.mockito.ArgumentMatchers.eq;
|
|
30
|
+import static org.mockito.Mockito.inOrder;
|
28
|
31
|
import static org.mockito.Mockito.spy;
|
29
|
32
|
import static org.mockito.Mockito.times;
|
30
|
33
|
import static org.mockito.Mockito.verify;
|
|
@@ -239,4 +242,19 @@ public class ModalPresenterTest extends BaseTest {
|
239
|
242
|
uut.dismissModal(modal1, root, root, listener);
|
240
|
243
|
verify(listener).onError(any());
|
241
|
244
|
}
|
|
245
|
+
|
|
246
|
+ @Test
|
|
247
|
+ public void dismissModal_successIsReportedBeforeViewIsDestroyed() {
|
|
248
|
+ disableShowModalAnimation(modal1);
|
|
249
|
+ disableDismissModalAnimation(modal1);
|
|
250
|
+ CommandListenerAdapter listener = Mockito.mock(CommandListenerAdapter.class);
|
|
251
|
+ ViewController modal = spy(modal1);
|
|
252
|
+ InOrder inOrder = inOrder(listener, modal);
|
|
253
|
+
|
|
254
|
+ uut.showModal(modal, root, new CommandListenerAdapter());
|
|
255
|
+
|
|
256
|
+ uut.dismissModal(modal, root, root, listener);
|
|
257
|
+ inOrder.verify(listener).onSuccess(modal.getId());
|
|
258
|
+ inOrder.verify(modal).destroy();
|
|
259
|
+ }
|
242
|
260
|
}
|