|  | @@ -0,0 +1,54 @@
 | 
	
		
			
			|  | 1 | +package com.reactnativenavigation.viewcontrollers;
 | 
	
		
			
			|  | 2 | +
 | 
	
		
			
			|  | 3 | +import android.app.Activity;
 | 
	
		
			
			|  | 4 | +
 | 
	
		
			
			|  | 5 | +import com.reactnativenavigation.BaseTest;
 | 
	
		
			
			|  | 6 | +import com.reactnativenavigation.mocks.SimpleViewController;
 | 
	
		
			
			|  | 7 | +import com.reactnativenavigation.parse.Options;
 | 
	
		
			
			|  | 8 | +import com.reactnativenavigation.parse.params.Bool;
 | 
	
		
			
			|  | 9 | +import com.reactnativenavigation.parse.params.Color;
 | 
	
		
			
			|  | 10 | +import com.reactnativenavigation.presentation.BottomTabsOptionsPresenter;
 | 
	
		
			
			|  | 11 | +import com.reactnativenavigation.viewcontrollers.bottomtabs.TabSelector;
 | 
	
		
			
			|  | 12 | +import com.reactnativenavigation.views.BottomTabs;
 | 
	
		
			
			|  | 13 | +import com.reactnativenavigation.views.Component;
 | 
	
		
			
			|  | 14 | +
 | 
	
		
			
			|  | 15 | +import org.junit.Test;
 | 
	
		
			
			|  | 16 | +import org.mockito.Mockito;
 | 
	
		
			
			|  | 17 | +
 | 
	
		
			
			|  | 18 | +import java.util.Arrays;
 | 
	
		
			
			|  | 19 | +import java.util.List;
 | 
	
		
			
			|  | 20 | +
 | 
	
		
			
			|  | 21 | +import static org.mockito.Mockito.spy;
 | 
	
		
			
			|  | 22 | +import static org.mockito.Mockito.verify;
 | 
	
		
			
			|  | 23 | +import static org.mockito.Mockito.verifyNoMoreInteractions;
 | 
	
		
			
			|  | 24 | +
 | 
	
		
			
			|  | 25 | +public class BottomTabsOptionsPresenterTest extends BaseTest {
 | 
	
		
			
			|  | 26 | +    private List<ViewController> tabs;
 | 
	
		
			
			|  | 27 | +    private BottomTabsOptionsPresenter uut;
 | 
	
		
			
			|  | 28 | +    private BottomTabs bottomTabs;
 | 
	
		
			
			|  | 29 | +
 | 
	
		
			
			|  | 30 | +    @Override
 | 
	
		
			
			|  | 31 | +    public void beforeEach() {
 | 
	
		
			
			|  | 32 | +        Activity activity = newActivity();
 | 
	
		
			
			|  | 33 | +        ChildControllersRegistry childRegistry = new ChildControllersRegistry();
 | 
	
		
			
			|  | 34 | +        ViewController child1 = spy(new SimpleViewController(activity, childRegistry, "child1", new Options()));
 | 
	
		
			
			|  | 35 | +        ViewController child2 = spy(new SimpleViewController(activity, childRegistry, "child2", new Options()));
 | 
	
		
			
			|  | 36 | +        tabs = Arrays.asList(child1, child2);
 | 
	
		
			
			|  | 37 | +        uut = new BottomTabsOptionsPresenter(tabs, new Options());
 | 
	
		
			
			|  | 38 | +        bottomTabs = Mockito.mock(BottomTabs.class);
 | 
	
		
			
			|  | 39 | +        uut.bindView(bottomTabs, Mockito.mock(TabSelector.class));
 | 
	
		
			
			|  | 40 | +    }
 | 
	
		
			
			|  | 41 | +
 | 
	
		
			
			|  | 42 | +    @Test
 | 
	
		
			
			|  | 43 | +    public void mergeChildOptions_onlyDeclaredOptionsAreApplied() { // default options are not applies on merge
 | 
	
		
			
			|  | 44 | +        Options defaultOptions = new Options();
 | 
	
		
			
			|  | 45 | +        defaultOptions.bottomTabsOptions.visible = new Bool(false);
 | 
	
		
			
			|  | 46 | +        uut.setDefaultOptions(defaultOptions);
 | 
	
		
			
			|  | 47 | +
 | 
	
		
			
			|  | 48 | +        Options options = new Options();
 | 
	
		
			
			|  | 49 | +        options.bottomTabsOptions.backgroundColor = new Color(10);
 | 
	
		
			
			|  | 50 | +        uut.mergeChildOptions(options, (Component) tabs.get(0).getView());
 | 
	
		
			
			|  | 51 | +        verify(bottomTabs).setBackgroundColor(options.bottomTabsOptions.backgroundColor.get());
 | 
	
		
			
			|  | 52 | +        verifyNoMoreInteractions(bottomTabs);
 | 
	
		
			
			|  | 53 | +    }
 | 
	
		
			
			|  | 54 | +}
 |