Search in sources :

Example 1 with NullThemeColour

use of com.reactnativenavigation.options.params.NullThemeColour in project react-native-navigation by wix.

the class BottomTabPresenterTest method applyOptions_shouldPresentBadgeIfAvailable.

@Test
public void applyOptions_shouldPresentBadgeIfAvailable() {
    final Options tab1 = tab1Options.copy();
    tab1.bottomTabOptions.badge = new NullText();
    tab1.bottomTabOptions.badgeColor = new NullThemeColour();
    final Options tab2 = tab2Options.copy();
    tab2.bottomTabOptions.badge = new Text("Badge");
    tab2.bottomTabOptions.badgeColor = ThemeColour.of(Color.RED);
    createBottomTabs(tab1, tab2, new Options());
    uut.applyOptions();
    ArgumentCaptor<AHNotification> notificationArgumentCaptor = ArgumentCaptor.forClass(AHNotification.class);
    verify(bottomTabs).setNotification(notificationArgumentCaptor.capture(), eq(1));
    final AHNotification value = notificationArgumentCaptor.getValue();
    assertThat(value.getReadableText()).isEqualTo("Badge");
    assertThat(value.getBackgroundColor()).isEqualTo(Color.RED);
    verify(bottomTabs, never()).setNotification(notificationArgumentCaptor.capture(), eq(0));
    verify(bottomTabs, never()).setNotification(notificationArgumentCaptor.capture(), eq(2));
}
Also used : Options(com.reactnativenavigation.options.Options) NullThemeColour(com.reactnativenavigation.options.params.NullThemeColour) Text(com.reactnativenavigation.options.params.Text) NullText(com.reactnativenavigation.options.params.NullText) NullText(com.reactnativenavigation.options.params.NullText) AHNotification(com.aurelhubert.ahbottomnavigation.notification.AHNotification) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

AHNotification (com.aurelhubert.ahbottomnavigation.notification.AHNotification)1 BaseTest (com.reactnativenavigation.BaseTest)1 Options (com.reactnativenavigation.options.Options)1 NullText (com.reactnativenavigation.options.params.NullText)1 NullThemeColour (com.reactnativenavigation.options.params.NullThemeColour)1 Text (com.reactnativenavigation.options.params.Text)1 Test (org.junit.Test)1