| 
				
			 | 
			
			
				@@ -7,6 +7,7 @@ import android.graphics.drawable.ColorDrawable; 
			 | 
		
	
		
			
			| 
				7
			 | 
			
				7
			 | 
			
			
				 import com.reactnativenavigation.BaseTest; 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				8
			 | 
			
			
				 import com.reactnativenavigation.mocks.TestContainerView; 
			 | 
		
	
		
			
			| 
				9
			 | 
			
				9
			 | 
			
			
				 import com.reactnativenavigation.parse.NavigationOptions; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				10
			 | 
			
			
				+import com.reactnativenavigation.presentation.OptionsPresenter; 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				11
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				11
			 | 
			
				12
			 | 
			
			
				 import org.junit.Test; 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				13
			 | 
			
			
				  
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -17,23 +18,20 @@ import static org.mockito.Mockito.verify; 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				18
			 | 
			
			
				 import static org.mockito.Mockito.when; 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				19
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				19
			 | 
			
				20
			 | 
			
			
				 public class ContainerViewControllerTest extends BaseTest { 
			 | 
		
	
		
			
			| 
				20
			 | 
			
				
			 | 
			
			
				-	private Activity activity; 
			 | 
		
	
		
			
			| 
				21
			 | 
			
				21
			 | 
			
			
				 	private ContainerViewController uut; 
			 | 
		
	
		
			
			| 
				22
			 | 
			
				22
			 | 
			
			
				 	private ContainerViewController.ContainerView view; 
			 | 
		
	
		
			
			| 
				23
			 | 
			
				
			 | 
			
			
				-	private NavigationOptions initialNavigationOptions; 
			 | 
		
	
		
			
			| 
				24
			 | 
			
				23
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				25
			 | 
			
				24
			 | 
			
			
				 	@Override 
			 | 
		
	
		
			
			| 
				26
			 | 
			
				25
			 | 
			
			
				 	public void beforeEach() { 
			 | 
		
	
		
			
			| 
				27
			 | 
			
				26
			 | 
			
			
				 		super.beforeEach(); 
			 | 
		
	
		
			
			| 
				28
			 | 
			
				
			 | 
			
			
				-		activity = newActivity(); 
			 | 
		
	
		
			
			| 
				29
			 | 
			
				
			 | 
			
			
				-		initialNavigationOptions = new NavigationOptions(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+		Activity activity = newActivity(); 
			 | 
		
	
		
			
			| 
				30
			 | 
			
				28
			 | 
			
			
				 		view = spy(new TestContainerView(activity)); 
			 | 
		
	
		
			
			| 
				31
			 | 
			
				29
			 | 
			
			
				 		uut = new ContainerViewController(activity, "containerId1", "containerName", new ContainerViewController.ContainerViewCreator() { 
			 | 
		
	
		
			
			| 
				32
			 | 
			
				30
			 | 
			
			
				 			@Override 
			 | 
		
	
		
			
			| 
				33
			 | 
			
				31
			 | 
			
			
				 			public ContainerViewController.ContainerView create(final Activity activity1, final String containerId, final String containerName) { 
			 | 
		
	
		
			
			| 
				34
			 | 
			
				32
			 | 
			
			
				 				return view; 
			 | 
		
	
		
			
			| 
				35
			 | 
			
				33
			 | 
			
			
				 			} 
			 | 
		
	
		
			
			| 
				36
			 | 
			
				
			 | 
			
			
				-		}, initialNavigationOptions); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+		}, new NavigationOptions()); 
			 | 
		
	
		
			
			| 
				37
			 | 
			
				35
			 | 
			
			
				 	} 
			 | 
		
	
		
			
			| 
				38
			 | 
			
				36
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				39
			 | 
			
				37
			 | 
			
			
				 	@Test 
			 | 
		
	
	
		
			
			| 
				
			 | 
			
			
				@@ -71,95 +69,4 @@ public class ContainerViewControllerTest extends BaseTest { 
			 | 
		
	
		
			
			| 
				71
			 | 
			
				69
			 | 
			
			
				 		when(view.isReady()).thenReturn(true); 
			 | 
		
	
		
			
			| 
				72
			 | 
			
				70
			 | 
			
			
				 		assertThat(uut.isViewShown()).isTrue(); 
			 | 
		
	
		
			
			| 
				73
			 | 
			
				71
			 | 
			
			
				 	} 
			 | 
		
	
		
			
			| 
				74
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				75
			 | 
			
				
			 | 
			
			
				-	@Test 
			 | 
		
	
		
			
			| 
				76
			 | 
			
				
			 | 
			
			
				-	public void applyNavigationOptionsHandlesNoParentStack() throws Exception { 
			 | 
		
	
		
			
			| 
				77
			 | 
			
				
			 | 
			
			
				-		assertThat(uut.getParentStackController()).isNull(); 
			 | 
		
	
		
			
			| 
				78
			 | 
			
				
			 | 
			
			
				-		uut.onViewAppeared(); 
			 | 
		
	
		
			
			| 
				79
			 | 
			
				
			 | 
			
			
				-		assertThat(uut.getParentStackController()).isNull(); 
			 | 
		
	
		
			
			| 
				80
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				81
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				82
			 | 
			
				
			 | 
			
			
				-	@Test 
			 | 
		
	
		
			
			| 
				83
			 | 
			
				
			 | 
			
			
				-	public void initialOptionsAppliedOnAppear() throws Exception { 
			 | 
		
	
		
			
			| 
				84
			 | 
			
				
			 | 
			
			
				-		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions); 
			 | 
		
	
		
			
			| 
				85
			 | 
			
				
			 | 
			
			
				-		initialNavigationOptions.title = "the title"; 
			 | 
		
	
		
			
			| 
				86
			 | 
			
				
			 | 
			
			
				-		StackController stackController = new StackController(activity, "stackId"); 
			 | 
		
	
		
			
			| 
				87
			 | 
			
				
			 | 
			
			
				-		stackController.push(uut); 
			 | 
		
	
		
			
			| 
				88
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitle()).isEmpty(); 
			 | 
		
	
		
			
			| 
				89
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				90
			 | 
			
				
			 | 
			
			
				-		uut.onViewAppeared(); 
			 | 
		
	
		
			
			| 
				91
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitle()).isEqualTo("the title"); 
			 | 
		
	
		
			
			| 
				92
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				93
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				94
			 | 
			
				
			 | 
			
			
				-	@Test 
			 | 
		
	
		
			
			| 
				95
			 | 
			
				
			 | 
			
			
				-	public void mergeNavigationOptionsUpdatesCurrentOptions() throws Exception { 
			 | 
		
	
		
			
			| 
				96
			 | 
			
				
			 | 
			
			
				-		assertThat(uut.getNavigationOptions().title).isEmpty(); 
			 | 
		
	
		
			
			| 
				97
			 | 
			
				
			 | 
			
			
				-		NavigationOptions options = new NavigationOptions(); 
			 | 
		
	
		
			
			| 
				98
			 | 
			
				
			 | 
			
			
				-		options.title = "new title"; 
			 | 
		
	
		
			
			| 
				99
			 | 
			
				
			 | 
			
			
				-		uut.mergeNavigationOptions(options); 
			 | 
		
	
		
			
			| 
				100
			 | 
			
				
			 | 
			
			
				-		assertThat(uut.getNavigationOptions().title).isEqualTo("new title"); 
			 | 
		
	
		
			
			| 
				101
			 | 
			
				
			 | 
			
			
				-		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions); 
			 | 
		
	
		
			
			| 
				102
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				103
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				104
			 | 
			
				
			 | 
			
			
				-	@Test 
			 | 
		
	
		
			
			| 
				105
			 | 
			
				
			 | 
			
			
				-	public void reappliesOptionsOnMerge() throws Exception { 
			 | 
		
	
		
			
			| 
				106
			 | 
			
				
			 | 
			
			
				-		StackController stackController = new StackController(activity, "stackId"); 
			 | 
		
	
		
			
			| 
				107
			 | 
			
				
			 | 
			
			
				-		stackController.push(uut); 
			 | 
		
	
		
			
			| 
				108
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitle()).isEmpty(); 
			 | 
		
	
		
			
			| 
				109
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				110
			 | 
			
				
			 | 
			
			
				-		NavigationOptions opts = new NavigationOptions(); 
			 | 
		
	
		
			
			| 
				111
			 | 
			
				
			 | 
			
			
				-		opts.title = "the new title"; 
			 | 
		
	
		
			
			| 
				112
			 | 
			
				
			 | 
			
			
				-		uut.mergeNavigationOptions(opts); 
			 | 
		
	
		
			
			| 
				113
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				114
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitle()).isEqualTo("the new title"); 
			 | 
		
	
		
			
			| 
				115
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				116
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				117
			 | 
			
				
			 | 
			
			
				-	@Test 
			 | 
		
	
		
			
			| 
				118
			 | 
			
				
			 | 
			
			
				-	public void appliesTopBackBackgroundColor() throws Exception { 
			 | 
		
	
		
			
			| 
				119
			 | 
			
				
			 | 
			
			
				-		StackController stackController = new StackController(activity, "stackId"); 
			 | 
		
	
		
			
			| 
				120
			 | 
			
				
			 | 
			
			
				-		stackController.push(uut); 
			 | 
		
	
		
			
			| 
				121
			 | 
			
				
			 | 
			
			
				-		assertThat(((ColorDrawable) stackController.getTopBar().getBackground()).getColor()).isNotEqualTo(0xffff0000); 
			 | 
		
	
		
			
			| 
				122
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				123
			 | 
			
				
			 | 
			
			
				-		NavigationOptions opts = new NavigationOptions(); 
			 | 
		
	
		
			
			| 
				124
			 | 
			
				
			 | 
			
			
				-		opts.topBarBackgroundColor = Color.RED; 
			 | 
		
	
		
			
			| 
				125
			 | 
			
				
			 | 
			
			
				-		uut.mergeNavigationOptions(opts); 
			 | 
		
	
		
			
			| 
				126
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				127
			 | 
			
				
			 | 
			
			
				-		assertThat(((ColorDrawable) stackController.getTopBar().getBackground()).getColor()).isEqualTo(0xffff0000); 
			 | 
		
	
		
			
			| 
				128
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				129
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				130
			 | 
			
				
			 | 
			
			
				-	@Test 
			 | 
		
	
		
			
			| 
				131
			 | 
			
				
			 | 
			
			
				-	public void appliesTopBarTextColor() throws Exception { 
			 | 
		
	
		
			
			| 
				132
			 | 
			
				
			 | 
			
			
				-		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions); 
			 | 
		
	
		
			
			| 
				133
			 | 
			
				
			 | 
			
			
				-		initialNavigationOptions.title = "the title"; 
			 | 
		
	
		
			
			| 
				134
			 | 
			
				
			 | 
			
			
				-		StackController stackController = new StackController(activity, "stackId"); 
			 | 
		
	
		
			
			| 
				135
			 | 
			
				
			 | 
			
			
				-		stackController.push(uut); 
			 | 
		
	
		
			
			| 
				136
			 | 
			
				
			 | 
			
			
				-		uut.onViewAppeared(); 
			 | 
		
	
		
			
			| 
				137
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitleTextView().getCurrentTextColor()).isNotEqualTo(Color.RED); 
			 | 
		
	
		
			
			| 
				138
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				139
			 | 
			
				
			 | 
			
			
				-		NavigationOptions opts = new NavigationOptions(); 
			 | 
		
	
		
			
			| 
				140
			 | 
			
				
			 | 
			
			
				-		opts.title = "the title"; 
			 | 
		
	
		
			
			| 
				141
			 | 
			
				
			 | 
			
			
				-		opts.topBarTextColor = Color.RED; 
			 | 
		
	
		
			
			| 
				142
			 | 
			
				
			 | 
			
			
				-		uut.mergeNavigationOptions(opts); 
			 | 
		
	
		
			
			| 
				143
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				144
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitleTextView()).isNotEqualTo(null); 
			 | 
		
	
		
			
			| 
				145
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitleTextView().getCurrentTextColor()).isEqualTo(Color.RED); 
			 | 
		
	
		
			
			| 
				146
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				147
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				148
			 | 
			
				
			 | 
			
			
				-	@Test 
			 | 
		
	
		
			
			| 
				149
			 | 
			
				
			 | 
			
			
				-	public void appliesTopBarTextSize() throws Exception { 
			 | 
		
	
		
			
			| 
				150
			 | 
			
				
			 | 
			
			
				-		assertThat(uut.getNavigationOptions()).isSameAs(initialNavigationOptions); 
			 | 
		
	
		
			
			| 
				151
			 | 
			
				
			 | 
			
			
				-		initialNavigationOptions.title = "the title"; 
			 | 
		
	
		
			
			| 
				152
			 | 
			
				
			 | 
			
			
				-		StackController stackController = new StackController(activity, "stackId"); 
			 | 
		
	
		
			
			| 
				153
			 | 
			
				
			 | 
			
			
				-		stackController.push(uut); 
			 | 
		
	
		
			
			| 
				154
			 | 
			
				
			 | 
			
			
				-		uut.onViewAppeared(); 
			 | 
		
	
		
			
			| 
				155
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitleTextView().getTextSize()).isNotEqualTo(18); 
			 | 
		
	
		
			
			| 
				156
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				157
			 | 
			
				
			 | 
			
			
				-		NavigationOptions opts = new NavigationOptions(); 
			 | 
		
	
		
			
			| 
				158
			 | 
			
				
			 | 
			
			
				-		opts.title = "the title"; 
			 | 
		
	
		
			
			| 
				159
			 | 
			
				
			 | 
			
			
				-		opts.topBarTextFontSize = 18; 
			 | 
		
	
		
			
			| 
				160
			 | 
			
				
			 | 
			
			
				-		uut.mergeNavigationOptions(opts); 
			 | 
		
	
		
			
			| 
				161
			 | 
			
				
			 | 
			
			
				- 
			 | 
		
	
		
			
			| 
				162
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitleTextView()).isNotEqualTo(null); 
			 | 
		
	
		
			
			| 
				163
			 | 
			
				
			 | 
			
			
				-		assertThat(stackController.getTopBar().getTitleTextView().getTextSize()).isEqualTo(18); 
			 | 
		
	
		
			
			| 
				164
			 | 
			
				
			 | 
			
			
				-	} 
			 | 
		
	
		
			
			| 
				165
			 | 
			
				72
			 | 
			
			
				 } 
			 |