Browse Source

Add tests for missing back button when stack root is set with multiple children

Guy Carmeli 5 years ago
parent
commit
1f9734d996

+ 12
- 0
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/stack/StackControllerTest.java View File

@@ -291,6 +291,18 @@ public class StackControllerTest extends BaseTest {
291 291
         });
292 292
     }
293 293
 
294
+    @Test
295
+    public void setRoot_backButtonIsAddedToAllChildren() {
296
+        Robolectric.getForegroundThreadScheduler().pause();
297
+
298
+        activity.setContentView(uut.getView());
299
+        disablePushAnimation(child1, child2);
300
+
301
+        uut.setRoot(Arrays.asList(child1, child2), new CommandListenerAdapter());
302
+        assertThat(child1.options.topBar.buttons.back.visible.get(false)).isFalse();
303
+        assertThat(child2.options.topBar.buttons.back.visible.get(false)).isTrue();
304
+    }
305
+
294 306
     @Test
295 307
     public void setRoot_doesNotCrashWhenCalledInQuickSuccession() {
296 308
         disablePushAnimation(child1);