|
@@ -187,6 +187,46 @@ public class LayoutFactoryTest {
|
187
|
187
|
assertThat(result.getChildAt(0)).isEqualTo(otherMockView);
|
188
|
188
|
}
|
189
|
189
|
|
|
190
|
+ @Test
|
|
191
|
+ public void pushTwoScreensToStackLayout() throws Exception {
|
|
192
|
+ when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
193
|
+ final LayoutNode container = createContainerNode();
|
|
194
|
+ final LayoutNode stackNode = createContainerStackNode(container);
|
|
195
|
+ final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
|
196
|
+
|
|
197
|
+ View first = new View(activity);
|
|
198
|
+ pushContainer(containerStackLayout, OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY, first);
|
|
199
|
+
|
|
200
|
+ View second = new View(activity);
|
|
201
|
+ pushContainer(containerStackLayout, "secondPushedScreenId", "secondPushedScreenKey", second);
|
|
202
|
+
|
|
203
|
+ ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
|
204
|
+ assertThat(result.getChildAt(0)).isEqualTo(second);
|
|
205
|
+ }
|
|
206
|
+
|
|
207
|
+ @Test
|
|
208
|
+ public void popTwoScreensFromStackLayout() throws Exception {
|
|
209
|
+ when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|
|
210
|
+ final LayoutNode container = createContainerNode();
|
|
211
|
+ final LayoutNode stackNode = createContainerStackNode(container);
|
|
212
|
+ final ContainerStackLayout containerStackLayout = (ContainerStackLayout) createLayoutFactory().create(stackNode);
|
|
213
|
+
|
|
214
|
+ pushContainer(containerStackLayout, OTHER_NODE_ID, OTHER_REACT_ROOT_VIEW_KEY, new View(activity));
|
|
215
|
+ pushContainer(containerStackLayout, "secondPushedScreenId", "secondPushedScreenKey", new View(activity));
|
|
216
|
+
|
|
217
|
+ containerStackLayout.pop();
|
|
218
|
+ containerStackLayout.pop();
|
|
219
|
+
|
|
220
|
+ ViewGroup result = (ViewGroup) TestUtils.assertViewChildrenCount(containerStackLayout, 1).get(0);
|
|
221
|
+ assertThat(result.getChildAt(0)).isEqualTo(mockView);
|
|
222
|
+ }
|
|
223
|
+
|
|
224
|
+ private void pushContainer(ContainerStackLayout containerStackLayout, String screenId, String reactRootViewKey, View rootView) {
|
|
225
|
+ when(reactRootViewCreator.create(eq(screenId), eq(reactRootViewKey))).thenReturn(rootView);
|
|
226
|
+ View pushedContainer = createLayoutFactory().create(createContainerNode(screenId, reactRootViewKey));
|
|
227
|
+ containerStackLayout.push(pushedContainer);
|
|
228
|
+ }
|
|
229
|
+
|
190
|
230
|
@Test
|
191
|
231
|
public void popScreenFromScreenStackLayout() {
|
192
|
232
|
when(reactRootViewCreator.create(eq(NODE_ID), eq(REACT_ROOT_VIEW_KEY))).thenReturn(mockView);
|