| 
				
			 | 
			
			
				@@ -1,18 +1,48 @@ 
			 | 
		
	
		
			
			| 
				1
			 | 
			
				1
			 | 
			
			
				 package com.reactnativenavigation.views; 
			 | 
		
	
		
			
			| 
				2
			 | 
			
				2
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				3
			 | 
			
				
			 | 
			
			
				-import com.reactnativenavigation.*; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				3
			 | 
			
			
				+import com.reactnativenavigation.BaseTest; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				4
			 | 
			
			
				+import com.reactnativenavigation.anim.TopBarAnimator; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				5
			 | 
			
			
				+import com.reactnativenavigation.parse.params.Bool; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				6
			 | 
			
			
				+import com.reactnativenavigation.parse.params.NullBool; 
			 | 
		
	
		
			
			| 
				4
			 | 
			
				7
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				5
			 | 
			
				
			 | 
			
			
				-import org.junit.*; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				8
			 | 
			
			
				+import org.junit.Test; 
			 | 
		
	
		
			
			| 
				6
			 | 
			
				9
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				7
			 | 
			
				
			 | 
			
			
				-import static org.assertj.core.api.Java6Assertions.*; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				10
			 | 
			
			
				+import static org.assertj.core.api.Java6Assertions.assertThat; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				11
			 | 
			
			
				+import static org.mockito.Mockito.spy; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				12
			 | 
			
			
				+import static org.mockito.Mockito.times; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				13
			 | 
			
			
				+import static org.mockito.Mockito.verify; 
			 | 
		
	
		
			
			| 
				8
			 | 
			
				14
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				9
			 | 
			
				15
			 | 
			
			
				 public class TopBarTest extends BaseTest { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				16
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				17
			 | 
			
			
				+    private TopBar uut; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				18
			 | 
			
			
				+    private TopBarAnimator animator; 
			 | 
		
	
		
			
			| 
				
			 | 
			
				19
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				20
			 | 
			
			
				+    @Override 
			 | 
		
	
		
			
			| 
				
			 | 
			
				21
			 | 
			
			
				+    public void beforeEach() { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				22
			 | 
			
			
				+        StackLayout parent = new StackLayout(newActivity()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				23
			 | 
			
			
				+        uut = new TopBar(newActivity(), buttonId -> {}, parent); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				24
			 | 
			
			
				+        animator = spy(new TopBarAnimator(uut)); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				25
			 | 
			
			
				+        uut.setAnimator(animator); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				26
			 | 
			
			
				+        parent.addView(uut); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				27
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				28
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				10
			 | 
			
				29
			 | 
			
			
				     @Test 
			 | 
		
	
		
			
			| 
				11
			 | 
			
				30
			 | 
			
			
				     public void title() throws Exception { 
			 | 
		
	
		
			
			| 
				12
			 | 
			
				
			 | 
			
			
				-        TopBar topBar = new TopBar(newActivity(), buttonId -> {}, null); 
			 | 
		
	
		
			
			| 
				13
			 | 
			
				
			 | 
			
			
				-        assertThat(topBar.getTitle()).isEmpty(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				31
			 | 
			
			
				+        assertThat(uut.getTitle()).isEmpty(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				32
			 | 
			
			
				+        uut.setTitle("new title"); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				33
			 | 
			
			
				+        assertThat(uut.getTitle()).isEqualTo("new title"); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				34
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				14
			 | 
			
				35
			 | 
			
			
				  
			 | 
		
	
		
			
			| 
				15
			 | 
			
				
			 | 
			
			
				-        topBar.setTitle("new title"); 
			 | 
		
	
		
			
			| 
				16
			 | 
			
				
			 | 
			
			
				-        assertThat(topBar.getTitle()).isEqualTo("new title"); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				36
			 | 
			
			
				+    @Test 
			 | 
		
	
		
			
			| 
				
			 | 
			
				37
			 | 
			
			
				+    public void hide_animateHideUnlessSpecifiedOtherwise() throws Exception { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				38
			 | 
			
			
				+        uut.hide(new NullBool()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				39
			 | 
			
			
				+        verify(animator, times(1)).hide(); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				40
			 | 
			
			
				+    } 
			 | 
		
	
		
			
			| 
				
			 | 
			
				41
			 | 
			
			
				+ 
			 | 
		
	
		
			
			| 
				
			 | 
			
				42
			 | 
			
			
				+    @Test 
			 | 
		
	
		
			
			| 
				
			 | 
			
				43
			 | 
			
			
				+    public void show_animateShowUnlessSpecifiedOtherwise() throws Exception { 
			 | 
		
	
		
			
			| 
				
			 | 
			
				44
			 | 
			
			
				+        uut.hide(new Bool(false)); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				45
			 | 
			
			
				+        uut.show(new NullBool()); 
			 | 
		
	
		
			
			| 
				
			 | 
			
				46
			 | 
			
			
				+        verify(animator, times(1)).show(); 
			 | 
		
	
		
			
			| 
				17
			 | 
			
				47
			 | 
			
			
				     } 
			 | 
		
	
		
			
			| 
				18
			 | 
			
				48
			 | 
			
			
				 } 
			 |