|
@@ -4,8 +4,8 @@ import android.app.Activity;
|
4
|
4
|
import android.support.annotation.NonNull;
|
5
|
5
|
|
6
|
6
|
import com.reactnativenavigation.BaseTest;
|
|
7
|
+import com.reactnativenavigation.mocks.SimpleContainerViewController;
|
7
|
8
|
import com.reactnativenavigation.mocks.SimpleViewController;
|
8
|
|
-import com.reactnativenavigation.mocks.TestContainerViewCreator;
|
9
|
9
|
import com.reactnativenavigation.mocks.TestStackAnimator;
|
10
|
10
|
import com.reactnativenavigation.parse.NavigationOptions;
|
11
|
11
|
import com.reactnativenavigation.utils.CompatUtils;
|
|
@@ -191,7 +191,7 @@ public class NavigatorTest extends BaseTest {
|
191
|
191
|
|
192
|
192
|
@Test
|
193
|
193
|
public void setOptions_CallsApplyNavigationOptions() {
|
194
|
|
- ContainerViewController containerVc = new ContainerViewController(activity, "theId", "theName", new TestContainerViewCreator(), new NavigationOptions());
|
|
194
|
+ ContainerViewController containerVc = new SimpleContainerViewController(activity, "theId");
|
195
|
195
|
uut.setRoot(containerVc);
|
196
|
196
|
assertThat(containerVc.getNavigationOptions().title).isEmpty();
|
197
|
197
|
|
|
@@ -204,8 +204,22 @@ public class NavigatorTest extends BaseTest {
|
204
|
204
|
|
205
|
205
|
@Test
|
206
|
206
|
public void setOptions_AffectsOnlyContainerViewControllers() {
|
207
|
|
- uut.setRoot(child1);
|
208
|
|
- uut.setOptions(child1.getId(), new NavigationOptions());
|
|
207
|
+ uut.setOptions("some unknown child id", new NavigationOptions());
|
|
208
|
+ }
|
|
209
|
+
|
|
210
|
+ @Test
|
|
211
|
+ public void setOptions_ActuallyAffectsTheTitleView() throws Exception {
|
|
212
|
+ ContainerViewController containerVc = new SimpleContainerViewController(activity, "theId");
|
|
213
|
+ StackController stackController = new StackController(activity, "stackId", new TestStackAnimator());
|
|
214
|
+ stackController.push(containerVc);
|
|
215
|
+ uut.setRoot(stackController);
|
|
216
|
+ assertThat(stackController.getTopBar().getTitle()).isEmpty();
|
|
217
|
+
|
|
218
|
+ NavigationOptions opts = new NavigationOptions();
|
|
219
|
+ opts.title = "the new title";
|
|
220
|
+ uut.setOptions("theId", opts);
|
|
221
|
+
|
|
222
|
+ assertThat(stackController.getTopBar().getTitle()).isEqualTo("the new title");
|
209
|
223
|
}
|
210
|
224
|
|
211
|
225
|
@NonNull
|