Search in sources :

Example 96 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class NavigatorTest method findController_overlay.

@Test
public void findController_overlay() {
    uut.showOverlay(child1, new CommandListenerAdapter());
    assertThat(uut.findController(child1.getId())).isEqualTo(child1);
}
Also used : CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 97 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class OptionsApplyingTest method appliesTopBackBackgroundColor.

@Test
public void appliesTopBackBackgroundColor() {
    uut.options.topBar.background.color = new ThemeColour(new Colour(Color.RED));
    stack.push(uut, new CommandListenerAdapter());
    idleMainLooper();
    assertThat(((ColorDrawable) stack.getTopBar().getBackground()).getColor()).isEqualTo(Color.RED);
}
Also used : ColorDrawable(android.graphics.drawable.ColorDrawable) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) Colour(com.reactnativenavigation.options.params.Colour) ThemeColour(com.reactnativenavigation.options.params.ThemeColour) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 98 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class OptionsApplyingTest method initialOptionsAppliedOnAppear.

@Test
public void initialOptionsAppliedOnAppear() {
    uut.options.topBar.title.text = new Text("the title");
    StackController stackController = TestUtils.newStackController(activity).build();
    stackController.ensureViewIsCreated();
    stackController.push(uut, new CommandListenerAdapter());
    assertThat(stackController.getTopBar().getTitle()).isEmpty();
    uut.onViewWillAppear();
    assertThat(stackController.getTopBar().getTitle()).isEqualTo("the title");
}
Also used : StackController(com.reactnativenavigation.viewcontrollers.stack.StackController) Text(com.reactnativenavigation.options.params.Text) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 99 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class OptionsApplyingTest method appliesTopBarVisible.

@Test
public void appliesTopBarVisible() {
    stack.push(uut, new CommandListenerAdapter());
    assertThat(uut.initialOptions).isSameAs(initialNavigationOptions);
    initialNavigationOptions.topBar.title.text = new Text("the title");
    assertThat(stack.getTopBar().getVisibility()).isNotEqualTo(View.GONE);
    Options opts = new Options();
    opts.topBar.visible = new Bool(false);
    opts.topBar.animate = new Bool(false);
    uut.mergeOptions(opts);
    assertThat(stack.getTopBar().getVisibility()).isEqualTo(View.GONE);
}
Also used : Options(com.reactnativenavigation.options.Options) Bool(com.reactnativenavigation.options.params.Bool) Text(com.reactnativenavigation.options.params.Text) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Example 100 with CommandListenerAdapter

use of com.reactnativenavigation.react.CommandListenerAdapter in project react-native-navigation by wix.

the class ModalStackTest method dismissModal_rejectIfModalNotFound.

@SuppressWarnings("Convert2Lambda")
@Test
public void dismissModal_rejectIfModalNotFound() {
    CommandListener listener = spy(new CommandListenerAdapter());
    Runnable onModalWillDismiss = spy(new Runnable() {

        @Override
        public void run() {
        }
    });
    uut.dismissModal(MODAL_ID_1, root, listener);
    verify(onModalWillDismiss, times(0)).run();
    verify(listener, times(1)).onError(anyString());
    verifyNoMoreInteractions(listener);
}
Also used : CommandListener(com.reactnativenavigation.react.CommandListener) CommandListenerAdapter(com.reactnativenavigation.react.CommandListenerAdapter) BaseTest(com.reactnativenavigation.BaseTest) Test(org.junit.Test)

Aggregations

CommandListenerAdapter (com.reactnativenavigation.react.CommandListenerAdapter)121 BaseTest (com.reactnativenavigation.BaseTest)115 Test (org.junit.Test)115 SimpleViewController (com.reactnativenavigation.mocks.SimpleViewController)22 StackController (com.reactnativenavigation.viewcontrollers.stack.StackController)19 Options (com.reactnativenavigation.options.Options)17 CommandListener (com.reactnativenavigation.react.CommandListener)16 Bool (com.reactnativenavigation.options.params.Bool)7 ModalOptions (com.reactnativenavigation.options.ModalOptions)5 BottomTabsController (com.reactnativenavigation.viewcontrollers.bottomtabs.BottomTabsController)5 Text (com.reactnativenavigation.options.params.Text)4 TransitionAnimationOptions (com.reactnativenavigation.options.TransitionAnimationOptions)3 FrameLayout (android.widget.FrameLayout)2 ArgumentMatchers.anyString (org.mockito.ArgumentMatchers.anyString)2 InOrder (org.mockito.InOrder)2 ColorDrawable (android.graphics.drawable.ColorDrawable)1 View (android.view.View)1 ViewGroup (android.view.ViewGroup)1 Nullable (androidx.annotation.Nullable)1 SimpleComponentViewController (com.reactnativenavigation.mocks.SimpleComponentViewController)1