|
@@ -203,6 +203,28 @@ public class StackControllerTest extends BaseTest {
|
203
|
203
|
assertThat(uut.size()).isEqualTo(2);
|
204
|
204
|
}
|
205
|
205
|
|
|
206
|
+ @Test
|
|
207
|
+ public void popToRoot_PopsEverythingAboveFirstController() throws Exception {
|
|
208
|
+ uut.push(child1);
|
|
209
|
+ uut.push(child2);
|
|
210
|
+ uut.push(child3);
|
|
211
|
+
|
|
212
|
+ assertThat(uut.size()).isEqualTo(3);
|
|
213
|
+ assertThat(uut.peek()).isEqualTo(child3);
|
|
214
|
+
|
|
215
|
+ uut.popToRoot();
|
|
216
|
+
|
|
217
|
+ assertThat(uut.size()).isEqualTo(1);
|
|
218
|
+ assertThat(uut.peek()).isEqualTo(child1);
|
|
219
|
+ }
|
|
220
|
+
|
|
221
|
+ @Test
|
|
222
|
+ public void popToRoot_EmptyStackDoesNothing() throws Exception {
|
|
223
|
+ assertThat(uut.isEmpty()).isTrue();
|
|
224
|
+ uut.popToRoot();
|
|
225
|
+ assertThat(uut.isEmpty()).isTrue();
|
|
226
|
+ }
|
|
227
|
+
|
206
|
228
|
private void assertHasSingleChildViewOfController(ViewController childController) {
|
207
|
229
|
assertThat(uut.getView().getChildCount()).isEqualTo(1);
|
208
|
230
|
assertThat(uut.getView().getChildAt(0)).isEqualTo(childController.getView());
|