Browse Source

test right side menu

Guy Carmeli 8 years ago
parent
commit
f7a0e8a49a

+ 14
- 0
android/app/src/test/java/com/reactnativenavigation/LayoutFactoryTest.java View File

@@ -124,6 +124,15 @@ public class LayoutFactoryTest {
124 124
         assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
125 125
     }
126 126
 
127
+    @Test
128
+    public void hasRightMenu() throws Exception {
129
+        when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
130
+        LayoutNode sideMenuRight = createSideMenuRightNode();
131
+        final LayoutNode sideMenu = createSideMenuContainerNode(Arrays.asList(sideMenuRight));
132
+        final ViewGroup result = (ViewGroup) createLayoutFactory().create(sideMenu);
133
+        assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
134
+    }
135
+
127 136
     @Test
128 137
     public void returnsSingleTabContent() throws Exception {
129 138
         BottomTabs bottomTabsMock = mock(BottomTabs.class);
@@ -195,6 +204,11 @@ public class LayoutFactoryTest {
195 204
         return new LayoutNode("SideMenuLeft", children);
196 205
     }
197 206
 
207
+    private LayoutNode createSideMenuRightNode() {
208
+        List<LayoutNode> children = Arrays.asList(createContainerNode());
209
+        return new LayoutNode("SideMenuRight", children);
210
+    }
211
+
198 212
     private LayoutNode createContainerNode(final String id, final String name) {
199 213
         return new LayoutNode(id, "Container", new HashMap<String, Object>() {{ put("name", name); }});
200 214
     }