mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Summary: Pull Request resolved: https://github.com/facebook/react-native/pull/25416 Use CocoaPods-based RNTesterPods workspace to run iOS unit tests and integration tests. This is necessary as new iOS projects now use CocoaPods by default. CocoaPods also powers the new package auto-linking feature. In order to provide test coverage for this new default configuration, our iOS tests are being migrated to use a CocoaPods-managed RNTester workspace. This applies to both Circle CI, and Sandcastle. Changelog: [iOS] [Changed] - Use RNTesterPods for iOS Tests Reviewed By: fkgozali Differential Revision: D16052466 fbshipit-source-id: 724b0c51008882d3c06a9074693fe23e74abe86b
70 lines
1.6 KiB
Objective-C
70 lines
1.6 KiB
Objective-C
/**
|
|
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
*
|
|
* This source code is licensed under the MIT license found in the
|
|
* LICENSE file in the root directory of this source tree.
|
|
*
|
|
*/
|
|
|
|
#import <XCTest/XCTest.h>
|
|
|
|
#if (defined(COCOAPODS))
|
|
#import <React-RCTTest/React/RCTTestRunner.h>
|
|
#else
|
|
#import <RCTTest/RCTTestRunner.h>
|
|
#endif
|
|
#import <React/RCTBridge.h>
|
|
#import <React/RCTDevMenu.h>
|
|
|
|
typedef void(^RCTDevMenuAlertActionHandler)(UIAlertAction *action);
|
|
|
|
@interface RCTDevMenu ()
|
|
|
|
- (RCTDevMenuAlertActionHandler)alertActionHandlerForDevItem:(RCTDevMenuItem *)item;
|
|
|
|
@end
|
|
|
|
@interface RCTDevMenuTests : XCTestCase
|
|
|
|
@end
|
|
|
|
@implementation RCTDevMenuTests
|
|
{
|
|
RCTBridge *_bridge;
|
|
}
|
|
|
|
- (void)setUp
|
|
{
|
|
[super setUp];
|
|
|
|
NSBundle *bundle = [NSBundle bundleForClass:[self class]];
|
|
_bridge = [[RCTBridge alloc] initWithBundleURL:[bundle URLForResource:@"RNTesterUnitTestsBundle" withExtension:@"js"]
|
|
moduleProvider:nil
|
|
launchOptions:nil];
|
|
|
|
RCT_RUN_RUNLOOP_WHILE(_bridge.isLoading);
|
|
}
|
|
|
|
- (void)testShowCreatingActionSheet
|
|
{
|
|
XCTAssertFalse([_bridge.devMenu isActionSheetShown]);
|
|
[_bridge.devMenu show];
|
|
XCTAssertTrue([_bridge.devMenu isActionSheetShown]);
|
|
}
|
|
|
|
- (void)testClosingActionSheetAfterAction
|
|
{
|
|
for (RCTDevMenuItem *item in _bridge.devMenu.presentedItems) {
|
|
RCTDevMenuAlertActionHandler handler = [_bridge.devMenu alertActionHandlerForDevItem:item];
|
|
XCTAssertTrue([_bridge.devMenu isActionSheetShown]);
|
|
|
|
handler(nil);
|
|
XCTAssertFalse([_bridge.devMenu isActionSheetShown]);
|
|
|
|
[_bridge.devMenu show];
|
|
XCTAssertTrue([_bridge.devMenu isActionSheetShown]);
|
|
}
|
|
}
|
|
|
|
@end
|