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
         assertThat(result.getChildAt(0)).isInstanceOf(Container.class);
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
     @Test
136
     @Test
128
     public void returnsSingleTabContent() throws Exception {
137
     public void returnsSingleTabContent() throws Exception {
129
         BottomTabs bottomTabsMock = mock(BottomTabs.class);
138
         BottomTabs bottomTabsMock = mock(BottomTabs.class);
195
         return new LayoutNode("SideMenuLeft", children);
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
     private LayoutNode createContainerNode(final String id, final String name) {
212
     private LayoutNode createContainerNode(final String id, final String name) {
199
         return new LayoutNode(id, "Container", new HashMap<String, Object>() {{ put("name", name); }});
213
         return new LayoutNode(id, "Container", new HashMap<String, Object>() {{ put("name", name); }});
200
     }
214
     }