Selaa lähdekoodia

Test that SideMenu visibility options are consumed after being applied

Guy Carmeli 5 vuotta sitten
vanhempi
commit
795fa80ea9

+ 0
- 5
lib/android/app/src/main/java/com/reactnativenavigation/presentation/SideMenuPresenter.java Näytä tiedosto

@@ -38,11 +38,6 @@ public class SideMenuPresenter {
38 38
         mergeVisibility(options);
39 39
     }
40 40
 
41
-    public void mergeChildOptions(SideMenuRootOptions options) {
42
-        mergeLockMode(options);
43
-        mergeVisibility(options);
44
-    }
45
-
46 41
     public void applyChildOptions(Options options) {
47 42
         applyLockMode(options.sideMenuRootOptions);
48 43
         mergeVisibility(options.sideMenuRootOptions);

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuController.java Näytä tiedosto

@@ -95,7 +95,7 @@ public class SideMenuController extends ParentController<SideMenuRoot> implement
95 95
     @Override
96 96
     public void mergeChildOptions(Options options, ViewController child) {
97 97
         super.mergeChildOptions(options, child);
98
-        presenter.mergeChildOptions(options.sideMenuRootOptions);
98
+        presenter.mergeOptions(options.sideMenuRootOptions);
99 99
     }
100 100
 
101 101
     @Override

+ 34
- 0
lib/android/app/src/test/java/com/reactnativenavigation/presentation/SideMenuPresenterTest.java Näytä tiedosto

@@ -0,0 +1,34 @@
1
+package com.reactnativenavigation.presentation;
2
+
3
+import com.reactnativenavigation.BaseTest;
4
+import com.reactnativenavigation.parse.SideMenuRootOptions;
5
+import com.reactnativenavigation.parse.params.Bool;
6
+import com.reactnativenavigation.views.SideMenu;
7
+
8
+import org.junit.Test;
9
+import org.mockito.Mockito;
10
+
11
+import static org.junit.Assert.assertFalse;
12
+
13
+public class SideMenuPresenterTest extends BaseTest {
14
+    private SideMenuPresenter uut;
15
+
16
+    @Override
17
+    public void beforeEach() {
18
+        uut = new SideMenuPresenter();
19
+        SideMenu sideMenu = Mockito.mock(SideMenu.class);
20
+        uut.bindView(sideMenu);
21
+    }
22
+
23
+    @Test
24
+    public void mergeVisibility_visibilityOptionsAreConsumed() {
25
+        SideMenuRootOptions options = new SideMenuRootOptions();
26
+        options.left.visible = new Bool(true);
27
+        options.right.visible = new Bool(true);
28
+
29
+        uut.mergeOptions(options);
30
+
31
+        assertFalse(options.right.visible.hasValue());
32
+        assertFalse(options.left.visible.hasValue());
33
+    }
34
+}

+ 1
- 1
lib/android/app/src/test/java/com/reactnativenavigation/viewcontrollers/sidemenu/SideMenuControllerTest.java Näytä tiedosto

@@ -165,7 +165,7 @@ public class SideMenuControllerTest extends BaseTest {
165 165
     public void mergeChildOptions() {
166 166
         Options options = new Options();
167 167
         uut.mergeChildOptions(options, child);
168
-        verify(presenter).mergeChildOptions(options.sideMenuRootOptions);
168
+        verify(presenter).mergeOptions(options.sideMenuRootOptions);
169 169
     }
170 170
 
171 171
     @Test