|
@@ -7,12 +7,10 @@ import android.widget.FrameLayout;
|
7
|
7
|
import com.reactnativenavigation.BaseTest;
|
8
|
8
|
import com.reactnativenavigation.mocks.SimpleViewController;
|
9
|
9
|
|
10
|
|
-import org.junit.Ignore;
|
11
|
10
|
import org.junit.Test;
|
12
|
11
|
|
13
|
12
|
import static org.assertj.core.api.Java6Assertions.assertThat;
|
14
|
13
|
|
15
|
|
-@Ignore
|
16
|
14
|
public class StackControllerTest extends BaseTest {
|
17
|
15
|
|
18
|
16
|
private Activity activity;
|
|
@@ -58,8 +56,6 @@ public class StackControllerTest extends BaseTest {
|
58
|
56
|
assertThat(uut.getChildControllers()).containsExactly(child2, child1);
|
59
|
57
|
uut.pop();
|
60
|
58
|
assertThat(uut.getChildControllers()).containsExactly(child1);
|
61
|
|
- uut.pop();
|
62
|
|
- assertThat(uut.getChildControllers()).isEmpty();
|
63
|
59
|
}
|
64
|
60
|
|
65
|
61
|
@Test
|
|
@@ -100,6 +96,29 @@ public class StackControllerTest extends BaseTest {
|
100
|
96
|
assertThat(uut.handleBack()).isFalse();
|
101
|
97
|
}
|
102
|
98
|
|
|
99
|
+ @Test
|
|
100
|
+ public void popDoesNothingWhenZeroOrOneChild() throws Exception {
|
|
101
|
+ assertThat(uut.getChildControllers().size()).isZero();
|
|
102
|
+ uut.pop();
|
|
103
|
+ assertThat(uut.getChildControllers().size()).isZero();
|
|
104
|
+
|
|
105
|
+ uut.push(child1);
|
|
106
|
+ uut.pop();
|
|
107
|
+ assertThat(uut.getChildControllers().size()).isEqualTo(1);
|
|
108
|
+ }
|
|
109
|
+
|
|
110
|
+ @Test
|
|
111
|
+ public void canPopWhenSizeIsMoreThanOne() throws Exception {
|
|
112
|
+ assertThat(uut.getChildControllers().size()).isZero();
|
|
113
|
+ assertThat(uut.canPop()).isFalse();
|
|
114
|
+ uut.push(child1);
|
|
115
|
+ assertThat(uut.getChildControllers().size()).isEqualTo(1);
|
|
116
|
+ assertThat(uut.canPop()).isFalse();
|
|
117
|
+ uut.push(child2);
|
|
118
|
+ assertThat(uut.getChildControllers().size()).isEqualTo(2);
|
|
119
|
+ assertThat(uut.canPop()).isTrue();
|
|
120
|
+ }
|
|
121
|
+
|
103
|
122
|
@Test
|
104
|
123
|
public void constructsSelfWithFrameLayout() throws Exception {
|
105
|
124
|
assertThat(uut.getView())
|