|
@@ -139,7 +139,7 @@ public class LayoutFactoryTest {
|
139
|
139
|
when(bottomTabsMock.size()).thenReturn(0);
|
140
|
140
|
|
141
|
141
|
when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
142
|
|
- final LayoutNode containerNode = createContainerNode();
|
|
142
|
+ final LayoutNode containerNode = createContainerStackNode(createContainerNode());
|
143
|
143
|
final LayoutNode tabNode = createBottomTabNode(containerNode);
|
144
|
144
|
|
145
|
145
|
final View result = createLayoutFactory(bottomTabsMock).create(tabNode);
|
|
@@ -147,7 +147,8 @@ public class LayoutFactoryTest {
|
147
|
147
|
verify(bottomTabsMock).add("#0");
|
148
|
148
|
|
149
|
149
|
assertThat(result).isInstanceOf(BottomTabsLayout.class);
|
150
|
|
- Container container = (Container) TestUtils.assertViewChildrenCount((BottomTabsLayout) result, 1).get(0);
|
|
150
|
+ ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount((BottomTabsLayout) result, 1).get(0);
|
|
151
|
+ Container container = (Container) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
151
|
152
|
View view = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
152
|
153
|
assertThat(view).isEqualTo(mockView);
|
153
|
154
|
}
|
|
@@ -158,7 +159,7 @@ public class LayoutFactoryTest {
|
158
|
159
|
when(bottomTabsMock.size()).thenReturn(0, 1);
|
159
|
160
|
|
160
|
161
|
when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
161
|
|
- final LayoutNode firstTabRootNode = createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY);
|
|
162
|
+ final LayoutNode firstTabRootNode = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
162
|
163
|
|
163
|
164
|
when(reactRootViewCreator.create(eq(OTHER_NODE_ID), eq(OTHER_REACT_ROOT_VIEW_KEY))).thenReturn(otherMockView);
|
164
|
165
|
final LayoutNode secondTabRootNode = createContainerStackNode(createContainerNode(OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY));
|
|
@@ -172,6 +173,51 @@ public class LayoutFactoryTest {
|
172
|
173
|
verify(bottomTabsMock).add(eq("#1"));
|
173
|
174
|
}
|
174
|
175
|
|
|
176
|
+ @Test
|
|
177
|
+ public void pushScreenToFirstBottomTab() {
|
|
178
|
+ BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
|
179
|
+ when(bottomTabsMock.size()).thenReturn(0, 1);
|
|
180
|
+
|
|
181
|
+ when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
182
|
+ final LayoutNode firstTabContainerStack = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
|
183
|
+
|
|
184
|
+ final LayoutNode tabNode = createBottomTabNode(firstTabContainerStack);
|
|
185
|
+ final BottomTabsLayout bottomTabsContainer = (BottomTabsLayout) createLayoutFactory(bottomTabsMock).create(tabNode);
|
|
186
|
+ verify(bottomTabsMock).add(eq("#0"));
|
|
187
|
+
|
|
188
|
+ View pushedReactView = new View(activity);
|
|
189
|
+ when(reactRootViewCreator.create(eq("pushedReactViewId"), eq("pushedReactViewKey"))).thenReturn(pushedReactView);
|
|
190
|
+ View view = createLayoutFactory().create(createContainerNode("pushedReactViewId", "pushedReactViewKey"));
|
|
191
|
+ bottomTabsContainer.push(view);
|
|
192
|
+
|
|
193
|
+ ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount(bottomTabsContainer, 1).get(0);
|
|
194
|
+ ViewGroup container = (ViewGroup) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
|
195
|
+ View result = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
|
196
|
+ assertThat(result).isEqualTo(pushedReactView);
|
|
197
|
+ }
|
|
198
|
+
|
|
199
|
+ @Test
|
|
200
|
+ public void popScreenFromFirstBottomTab() {
|
|
201
|
+ BottomTabs bottomTabsMock = mock(BottomTabs.class);
|
|
202
|
+ when(bottomTabsMock.size()).thenReturn(0, 1);
|
|
203
|
+
|
|
204
|
+ when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
205
|
+ final LayoutNode firstTabContainerStack = createContainerStackNode(createContainerNode(NODE_ID, REACT_ROOT_VIEW_KEY));
|
|
206
|
+
|
|
207
|
+ final LayoutNode tabNode = createBottomTabNode(firstTabContainerStack);
|
|
208
|
+ final BottomTabsLayout bottomTabsContainer = (BottomTabsLayout) createLayoutFactory(bottomTabsMock).create(tabNode);
|
|
209
|
+ verify(bottomTabsMock).add(eq("#0"));
|
|
210
|
+
|
|
211
|
+ pushContainer(bottomTabsContainer, "pushedReactViewId", "pushedReactViewKey", new View(activity));
|
|
212
|
+
|
|
213
|
+ bottomTabsContainer.pop();
|
|
214
|
+
|
|
215
|
+ ViewGroup containerStack = (ViewGroup) TestUtils.assertViewChildrenCount(bottomTabsContainer, 1).get(0);
|
|
216
|
+ ViewGroup container = (ViewGroup) TestUtils.assertViewChildrenCount(containerStack, 1).get(0);
|
|
217
|
+ View result = TestUtils.assertViewChildrenCount(container, 1).get(0);
|
|
218
|
+ assertThat(result).isEqualTo(mockView);
|
|
219
|
+ }
|
|
220
|
+
|
175
|
221
|
@Test
|
176
|
222
|
public void pushScreenToScreenStackLayout() throws Exception {
|
177
|
223
|
when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
@@ -227,6 +273,12 @@ public class LayoutFactoryTest {
|
227
|
273
|
containerStackLayout.push(pushedContainer);
|
228
|
274
|
}
|
229
|
275
|
|
|
276
|
+ private void pushContainer(BottomTabsLayout containerStackLayout, String screenId, String reactRootViewKey, View rootView) {
|
|
277
|
+ when(reactRootViewCreator.create(eq(screenId), eq(reactRootViewKey))).thenReturn(rootView);
|
|
278
|
+ View pushedContainer = createLayoutFactory().create(createContainerNode(screenId, reactRootViewKey));
|
|
279
|
+ containerStackLayout.push(pushedContainer);
|
|
280
|
+ }
|
|
281
|
+
|
230
|
282
|
@Test
|
231
|
283
|
public void popScreenFromScreenStackLayout() {
|
232
|
284
|
when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|