|
@@ -155,7 +155,7 @@ public class StackControllerTest extends BaseTest {
|
155
|
155
|
uut.pop(new CommandListenerAdapter() {
|
156
|
156
|
@Override
|
157
|
157
|
public void onSuccess(String childId) {
|
158
|
|
- verify(stackLayout[0], times(1)).onChildWillDisappear(child2.options, child1.options);
|
|
158
|
+ verify(stackLayout[0], times(1)).onChildWillPop(child2.options, child1.options);
|
159
|
159
|
}
|
160
|
160
|
});
|
161
|
161
|
}
|
|
@@ -254,10 +254,9 @@ public class StackControllerTest extends BaseTest {
|
254
|
254
|
uut.ensureViewIsCreated();
|
255
|
255
|
child1.ensureViewIsCreated();
|
256
|
256
|
|
257
|
|
- child1.options.topBarOptions.visible = new Bool(false);
|
258
|
|
- child1.options.topBarOptions.animate = new Bool(false);
|
259
|
|
- child1.options.animated = new Bool(false);
|
260
|
|
- child2.options.animated = new Bool(false);
|
|
257
|
+ child1.options.topBar.visible = new Bool(false);
|
|
258
|
+ child1.options.topBar.animate = new Bool(false);
|
|
259
|
+ disablePushAnimation(child1, child2);
|
261
|
260
|
|
262
|
261
|
uut.push(child1, new CommandListenerAdapter() {
|
263
|
262
|
@Override
|
|
@@ -267,7 +266,7 @@ public class StackControllerTest extends BaseTest {
|
267
|
266
|
|
268
|
267
|
uut.push(child2, new CommandListenerAdapter());
|
269
|
268
|
child2.onViewAppeared();
|
270
|
|
- verify(uut.getTopBar(), times(0)).showAnimate(child2.options.animationsOptions.push.topBar);
|
|
269
|
+ verify(uut.getTopBar(), times(0)).showAnimate(child2.options.animations.push.topBar);
|
271
|
270
|
assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.VISIBLE);
|
272
|
271
|
verify(uut.getTopBar(), times(1)).resetAnimationOptions();
|
273
|
272
|
}
|
|
@@ -278,9 +277,9 @@ public class StackControllerTest extends BaseTest {
|
278
|
277
|
public void push_animatesAndClearsPreviousAnimationValues() {
|
279
|
278
|
uut.ensureViewIsCreated();
|
280
|
279
|
|
281
|
|
- child1.options.topBarOptions.visible = new Bool(false);
|
282
|
|
- child1.options.topBarOptions.animate = new Bool(false);
|
283
|
|
- child1.options.animated = new Bool(false);
|
|
280
|
+ child1.options.topBar.visible = new Bool(false);
|
|
281
|
+ child1.options.topBar.animate = new Bool(false);
|
|
282
|
+ child1.options.animations.push.enabled = new Bool(false);
|
284
|
283
|
|
285
|
284
|
uut.push(child1, new CommandListenerAdapter());
|
286
|
285
|
uut.push(child2, new CommandListenerAdapter() {
|
|
@@ -385,8 +384,8 @@ public class StackControllerTest extends BaseTest {
|
385
|
384
|
|
386
|
385
|
@Test
|
387
|
386
|
public void popToRoot_PopsEverythingAboveFirstController() {
|
388
|
|
- child1.options.animated = new Bool(false);
|
389
|
|
- child2.options.animated = new Bool(false);
|
|
387
|
+ child1.options.animations.push.enabled = new Bool(false);
|
|
388
|
+ child2.options.animations.push.enabled = new Bool(false);
|
390
|
389
|
|
391
|
390
|
uut.push(child1, new CommandListenerAdapter());
|
392
|
391
|
uut.push(child2, new CommandListenerAdapter());
|
|
@@ -409,16 +408,14 @@ public class StackControllerTest extends BaseTest {
|
409
|
408
|
|
410
|
409
|
@Test
|
411
|
410
|
public void popToRoot_onlyTopChildIsAnimated() {
|
412
|
|
- child1.options.animated = new Bool(false);
|
413
|
|
- child2.options.animated = new Bool(false);
|
|
411
|
+ child1.options.animations.push.enabled = new Bool(false);
|
|
412
|
+ child2.options.animations.push.enabled = new Bool(false);
|
414
|
413
|
|
415
|
414
|
uut.push(child1, new CommandListenerAdapter());
|
416
|
415
|
uut.push(child2, new CommandListenerAdapter());
|
417
|
416
|
uut.push(child3, new CommandListenerAdapter() {
|
418
|
417
|
@Override
|
419
|
418
|
public void onSuccess(String childId) {
|
420
|
|
- child1.options.animated = new Bool(true);
|
421
|
|
- child2.options.animated = new Bool(true);
|
422
|
419
|
uut.popToRoot(new CommandListenerAdapter() {
|
423
|
420
|
@Override
|
424
|
421
|
public void onSuccess(String childId) {
|
|
@@ -431,9 +428,9 @@ public class StackControllerTest extends BaseTest {
|
431
|
428
|
|
432
|
429
|
@Test
|
433
|
430
|
public void popToRoot_topChildrenAreDestroyed() {
|
434
|
|
- child1.options.animated = new Bool(false);
|
435
|
|
- child2.options.animated = new Bool(false);
|
436
|
|
- child3.options.animated = new Bool(false);
|
|
431
|
+ child1.options.animations.push.enabled = new Bool(false);
|
|
432
|
+ child2.options.animations.push.enabled = new Bool(false);
|
|
433
|
+ child3.options.animations.push.enabled = new Bool(false);
|
437
|
434
|
|
438
|
435
|
uut.push(child1, new CommandListenerAdapter());
|
439
|
436
|
uut.push(child2, new CommandListenerAdapter());
|
|
@@ -493,8 +490,8 @@ public class StackControllerTest extends BaseTest {
|
493
|
490
|
|
494
|
491
|
@Test
|
495
|
492
|
public void pop_callWillAppearWillDisappear() {
|
496
|
|
- child1.options.animated = new Bool(false);
|
497
|
|
- child2.options.animated = new Bool(false);
|
|
493
|
+ child1.options.animations.push.enabled = new Bool(false);
|
|
494
|
+ child2.options.animations.push.enabled = new Bool(false);
|
498
|
495
|
child1 = spy(child1);
|
499
|
496
|
child2 = spy(child2);
|
500
|
497
|
uut.push(child1, new CommandListenerAdapter());
|
|
@@ -508,9 +505,9 @@ public class StackControllerTest extends BaseTest {
|
508
|
505
|
public void pop_animatesTopBar() {
|
509
|
506
|
uut.ensureViewIsCreated();
|
510
|
507
|
|
511
|
|
- child1.options.topBarOptions.visible = new Bool(false);
|
512
|
|
- child1.options.animated = new Bool(false);
|
513
|
|
- child2.options.animated = new Bool(true);
|
|
508
|
+ child1.options.topBar.visible = new Bool(false);
|
|
509
|
+ child1.options.animations.push.enabled = new Bool(false);
|
|
510
|
+ child2.options.animations.push.enabled = new Bool(true);
|
514
|
511
|
uut.push(child1, new CommandListenerAdapter() {
|
515
|
512
|
@Override
|
516
|
513
|
public void onSuccess(String childId) {
|
|
@@ -522,7 +519,7 @@ public class StackControllerTest extends BaseTest {
|
522
|
519
|
uut.pop(new CommandListenerAdapter() {
|
523
|
520
|
@Override
|
524
|
521
|
public void onSuccess(String childId) {
|
525
|
|
- verify(uut.getTopBar(), times(1)).hideAnimate(child2.options.animationsOptions.pop.topBar);
|
|
522
|
+ verify(uut.getTopBar(), times(1)).hideAnimate(child2.options.animations.pop.topBar);
|
526
|
523
|
}
|
527
|
524
|
});
|
528
|
525
|
}
|
|
@@ -535,8 +532,11 @@ public class StackControllerTest extends BaseTest {
|
535
|
532
|
public void pop_doesNotAnimateTopBarIfScreenIsPushedWithoutAnimation() {
|
536
|
533
|
uut.ensureViewIsCreated();
|
537
|
534
|
|
538
|
|
- child1.options.topBarOptions.visible = new Bool(false);
|
539
|
|
- child2.options.animated = new Bool(false);
|
|
535
|
+ child1.options.topBar.visible = new Bool(false);
|
|
536
|
+ child1.options.topBar.animate = new Bool(false);
|
|
537
|
+ child2.options.animations.push.enabled = new Bool(false);
|
|
538
|
+ child2.options.topBar.animate = new Bool(false);
|
|
539
|
+
|
540
|
540
|
child1.ensureViewIsCreated();
|
541
|
541
|
uut.push(child1, new CommandListenerAdapter() {
|
542
|
542
|
@Override
|
|
@@ -545,7 +545,7 @@ public class StackControllerTest extends BaseTest {
|
545
|
545
|
assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.VISIBLE);
|
546
|
546
|
|
547
|
547
|
uut.pop(new CommandListenerAdapter());
|
548
|
|
- verify(uut.getTopBar(), times(0)).hideAnimate(child2.options.animationsOptions.pop.topBar);
|
|
548
|
+ verify(uut.getTopBar(), times(0)).hideAnimate(child2.options.animations.pop.topBar);
|
549
|
549
|
assertThat(uut.getTopBar().getVisibility()).isEqualTo(View.GONE);
|
550
|
550
|
}
|
551
|
551
|
});
|
|
@@ -605,7 +605,7 @@ public class StackControllerTest extends BaseTest {
|
605
|
605
|
parent.push(uut, new CommandListenerAdapter());
|
606
|
606
|
|
607
|
607
|
Options childOptions = new Options();
|
608
|
|
- childOptions.topBarOptions.title.text = new Text("Something");
|
|
608
|
+ childOptions.topBar.title.text = new Text("Something");
|
609
|
609
|
child1.options = childOptions;
|
610
|
610
|
uut.push(child1, new CommandListenerAdapter());
|
611
|
611
|
child1.ensureViewIsCreated();
|
|
@@ -614,7 +614,7 @@ public class StackControllerTest extends BaseTest {
|
614
|
614
|
ArgumentCaptor<Options> optionsCaptor = ArgumentCaptor.forClass(Options.class);
|
615
|
615
|
ArgumentCaptor<ReactComponent> viewCaptor = ArgumentCaptor.forClass(ReactComponent.class);
|
616
|
616
|
verify(parent, times(1)).applyChildOptions(optionsCaptor.capture(), viewCaptor.capture());
|
617
|
|
- assertThat(optionsCaptor.getValue().topBarOptions.title.text.hasValue()).isFalse();
|
|
617
|
+ assertThat(optionsCaptor.getValue().topBar.title.text.hasValue()).isFalse();
|
618
|
618
|
}
|
619
|
619
|
|
620
|
620
|
@Test
|
|
@@ -667,14 +667,14 @@ public class StackControllerTest extends BaseTest {
|
667
|
667
|
ParentController parentController = Mockito.mock(ParentController.class);
|
668
|
668
|
uut.setParentController(parentController);
|
669
|
669
|
Options optionsToMerge = new Options();
|
670
|
|
- optionsToMerge.topBarOptions.testId = new Text("topBarID");
|
|
670
|
+ optionsToMerge.topBar.testId = new Text("topBarID");
|
671
|
671
|
optionsToMerge.bottomTabsOptions.testId = new Text("bottomTabsID");
|
672
|
672
|
Component component = mock(Component.class);
|
673
|
673
|
uut.mergeChildOptions(optionsToMerge, component);
|
674
|
674
|
|
675
|
675
|
ArgumentCaptor<Options> captor = ArgumentCaptor.forClass(Options.class);
|
676
|
676
|
verify(parentController, times(1)).mergeChildOptions(captor.capture(), eq(component));
|
677
|
|
- assertThat(captor.getValue().topBarOptions.testId.hasValue()).isFalse();
|
|
677
|
+ assertThat(captor.getValue().topBar.testId.hasValue()).isFalse();
|
678
|
678
|
assertThat(captor.getValue().bottomTabsOptions.testId.get()).isEqualTo(optionsToMerge.bottomTabsOptions.testId.get());
|
679
|
679
|
}
|
680
|
680
|
|
|
@@ -684,8 +684,8 @@ public class StackControllerTest extends BaseTest {
|
684
|
684
|
Component component = mock(Component.class);
|
685
|
685
|
|
686
|
686
|
uut.mergeChildOptions(options, component);
|
687
|
|
- verify(animator, times(0)).setOptions(options.animationsOptions);
|
688
|
|
- verify(animator, times(1)).mergeOptions(options.animationsOptions);
|
|
687
|
+ verify(animator, times(0)).setOptions(options.animations);
|
|
688
|
+ verify(animator, times(1)).mergeOptions(options.animations);
|
689
|
689
|
}
|
690
|
690
|
|
691
|
691
|
@Test
|
|
@@ -693,8 +693,8 @@ public class StackControllerTest extends BaseTest {
|
693
|
693
|
ParentController parentController = Mockito.mock(ParentController.class);
|
694
|
694
|
uut.setParentController(parentController);
|
695
|
695
|
Options options = new Options();
|
696
|
|
- options.animationsOptions.push = NestedAnimationsOptions.parse(new JSONObject());
|
697
|
|
- options.topBarOptions.testId = new Text("id");
|
|
696
|
+ options.animations.push = NestedAnimationsOptions.parse(new JSONObject());
|
|
697
|
+ options.topBar.testId = new Text("id");
|
698
|
698
|
options.fabOptions.id = new Text("fabId");
|
699
|
699
|
Component component = mock(Component.class);
|
700
|
700
|
|
|
@@ -702,8 +702,8 @@ public class StackControllerTest extends BaseTest {
|
702
|
702
|
uut.mergeChildOptions(options, component);
|
703
|
703
|
ArgumentCaptor<Options> captor = ArgumentCaptor.forClass(Options.class);
|
704
|
704
|
verify(parentController, times(1)).mergeChildOptions(captor.capture(), eq(component));
|
705
|
|
- assertThat(captor.getValue().animationsOptions.push.hasValue()).isFalse();
|
706
|
|
- assertThat(captor.getValue().topBarOptions.testId.hasValue()).isFalse();
|
|
705
|
+ assertThat(captor.getValue().animations.push.hasValue()).isFalse();
|
|
706
|
+ assertThat(captor.getValue().topBar.testId.hasValue()).isFalse();
|
707
|
707
|
assertThat(captor.getValue().fabOptions.hasValue()).isFalse();
|
708
|
708
|
}
|
709
|
709
|
|