Java Code Examples for com.facebook.react.bridge.ReactTestHelper

The following are top voted examples for showing how to use com.facebook.react.bridge.ReactTestHelper. These examples are extracted from open source projects. You can vote up the examples you like and your votes will be used in our system to generate more good examples.
Example 1
Project: ReactNativeSignatureExample   File: TextInputTest.java   View source code 6 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  DisplayMetrics displayMetrics = reactContext.getResources().getDisplayMetrics();
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);
  DisplayMetricsHolder.setScreenDisplayMetrics(displayMetrics);
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementation(reactContext, viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 2
Project: ReactNativeSignatureExample   File: ReactTextTest.java   View source code 6 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  DisplayMetrics displayMetrics = reactContext.getResources().getDisplayMetrics();
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);
  DisplayMetricsHolder.setScreenDisplayMetrics(displayMetrics);
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),
          new ReactRawTextManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementation(reactContext, viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 3
Project: react-native-ibeacon-android   File: TextInputTest.java   View source code 6 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  DisplayMetrics displayMetrics = reactContext.getResources().getDisplayMetrics();
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);
  DisplayMetricsHolder.setScreenDisplayMetrics(displayMetrics);
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementation(reactContext, viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 4
Project: react-native-ibeacon-android   File: ReactTextTest.java   View source code 6 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  DisplayMetrics displayMetrics = reactContext.getResources().getDisplayMetrics();
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);
  DisplayMetricsHolder.setScreenDisplayMetrics(displayMetrics);
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),
          new ReactRawTextManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementation(reactContext, viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 5
Project: react-native-box-loaders   File: TextInputTest.java   View source code 6 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  DisplayMetrics displayMetrics = reactContext.getResources().getDisplayMetrics();
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);
  DisplayMetricsHolder.setScreenDisplayMetrics(displayMetrics);
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementation(reactContext, viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 6
Project: react-native-box-loaders   File: ReactTextTest.java   View source code 6 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  DisplayMetrics displayMetrics = reactContext.getResources().getDisplayMetrics();
  DisplayMetricsHolder.setWindowDisplayMetrics(displayMetrics);
  DisplayMetricsHolder.setScreenDisplayMetrics(displayMetrics);
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),
          new ReactRawTextManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementation(reactContext, viewManagers));
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 7
Project: RNLearn_Project1   File: TextInputTest.java   View source code 5 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 8
Project: RNLearn_Project1   File: ReactTextInputPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactTextInputManager();
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 9
Project: RNLearn_Project1   File: ReactSliderPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  ReactApplicationContext mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  CatalystInstance mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactSliderManager();
}
 
Example 10
Project: RNLearn_Project1   File: ReactTextTest.java   View source code 5 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),
          new ReactRawTextManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 11
Project: RNLearn_Project1   File: ReactImagePropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext, mContext);
  Fresco.initialize(mContext);
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 12
Project: RNLearn_Project1   File: ShareModuleTest.java   View source code 5 votes vote down vote up
@Before
public void prepareModules() throws Exception {
  PowerMockito.mockStatic(Arguments.class);
  Mockito.when(Arguments.createMap()).thenAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) throws Throwable {
      return new JavaOnlyMap();
    }
  });

  mShareModule = new ShareModule(ReactTestHelper.createCatalystContextForTest());
}
 
Example 13
Project: RNLearn_Project1   File: SimpleViewPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
 
Example 14
Project: RNLearn_Project1   File: TextInputTest.java   View source code 5 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 15
Project: RNLearn_Project1   File: ReactTextInputPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactTextInputManager();
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 16
Project: RNLearn_Project1   File: ReactSliderPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  ReactApplicationContext mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  CatalystInstance mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactSliderManager();
}
 
Example 17
Project: RNLearn_Project1   File: ReactTextTest.java   View source code 5 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),
          new ReactRawTextManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider(),
      false);
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 18
Project: RNLearn_Project1   File: ReactImagePropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext, mContext);
  Fresco.initialize(mContext);
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 19
Project: RNLearn_Project1   File: ShareModuleTest.java   View source code 5 votes vote down vote up
@Before
public void prepareModules() throws Exception {
  PowerMockito.mockStatic(Arguments.class);
  Mockito.when(Arguments.createMap()).thenAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) throws Throwable {
      return new JavaOnlyMap();
    }
  });

  mShareModule = new ShareModule(ReactTestHelper.createCatalystContextForTest());
}
 
Example 20
Project: RNLearn_Project1   File: SimpleViewPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
 
Example 21
Project: ReactNativeSignatureExample   File: ReactTextInputPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactTextInputManager();
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 22
Project: ReactNativeSignatureExample   File: ReactImagePropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext, mContext);
  Fresco.initialize(mContext);
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 23
Project: ReactNativeSignatureExample   File: SimpleViewPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
 
Example 24
Project: react-native-ibeacon-android   File: ReactTextInputPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactTextInputManager();
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 25
Project: react-native-ibeacon-android   File: ReactImagePropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext, mContext);
  Fresco.initialize(mContext);
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 26
Project: react-native-ibeacon-android   File: SimpleViewPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
 
Example 27
Project: react-native-box-loaders   File: ReactTextInputPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactTextInputManager();
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 28
Project: react-native-box-loaders   File: ReactImagePropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext, mContext);
  Fresco.initialize(mContext);
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 29
Project: react-native-box-loaders   File: SimpleViewPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
 
Example 30
Project: Ironman   File: TextInputTest.java   View source code 5 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextInputManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider());
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 31
Project: Ironman   File: ReactTextInputPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ReactTextInputManager();
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 32
Project: Ironman   File: ReactTextTest.java   View source code 5 votes vote down vote up
public UIManagerModule getUIManagerModule() {
  ReactApplicationContext reactContext = ReactTestHelper.createCatalystContextForTest();
  List<ViewManager> viewManagers = Arrays.asList(
      new ViewManager[] {
          new ReactTextViewManager(),
          new ReactRawTextManager(),
      });
  UIManagerModule uiManagerModule = new UIManagerModule(
      reactContext,
      viewManagers,
      new UIImplementationProvider());
  uiManagerModule.onHostResume();
  return uiManagerModule;
}
 
Example 33
Project: Ironman   File: ReactImagePropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemeContext = new ThemedReactContext(mContext, mContext);
  Fresco.initialize(mContext);
  DisplayMetricsHolder.setWindowDisplayMetrics(new DisplayMetrics());
}
 
Example 34
Project: Ironman   File: ShareModuleTest.java   View source code 5 votes vote down vote up
@Before
public void prepareModules() throws Exception {
  PowerMockito.mockStatic(Arguments.class);
  Mockito.when(Arguments.createMap()).thenAnswer(new Answer<Object>() {
    @Override
    public Object answer(InvocationOnMock invocation) throws Throwable {
      return new JavaOnlyMap();
    }
  });

  mShareModule = new ShareModule(ReactTestHelper.createCatalystContextForTest());
}
 
Example 35
Project: Ironman   File: SimpleViewPropertyTest.java   View source code 5 votes vote down vote up
@Before
public void setup() {
  mContext = new ReactApplicationContext(RuntimeEnvironment.application);
  mCatalystInstanceMock = ReactTestHelper.createMockCatalystInstance();
  mContext.initializeWithInstance(mCatalystInstanceMock);
  mThemedContext = new ThemedReactContext(mContext, mContext);
  mManager = new ConcreteViewManager();
}
 
Example 36
Project: ReactNativeSignatureExample   File: ClipboardModuleTest.java   View source code 4 votes vote down vote up
@Before
public void setUp() {
  mClipboardModule = new ClipboardModule(ReactTestHelper.createCatalystContextForTest());
  mClipboardManager =
      (ClipboardManager) RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
}
 
Example 37
Project: react-native-ibeacon-android   File: ClipboardModuleTest.java   View source code 4 votes vote down vote up
@Before
public void setUp() {
  mClipboardModule = new ClipboardModule(ReactTestHelper.createCatalystContextForTest());
  mClipboardManager =
      (ClipboardManager) RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
}
 
Example 38
Project: react-native-box-loaders   File: ClipboardModuleTest.java   View source code 4 votes vote down vote up
@Before
public void setUp() {
  mClipboardModule = new ClipboardModule(ReactTestHelper.createCatalystContextForTest());
  mClipboardManager =
      (ClipboardManager) RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
}
 
Example 39
Project: Ironman   File: ClipboardModuleTest.java   View source code 4 votes vote down vote up
@Before
public void setUp() {
  mClipboardModule = new ClipboardModule(ReactTestHelper.createCatalystContextForTest());
  mClipboardManager =
      (ClipboardManager) RuntimeEnvironment.application.getSystemService(Context.CLIPBOARD_SERVICE);
}