|
24 | 24 |
|
25 | 25 | @protocol RCTBridgeModule; |
26 | 26 |
|
| 27 | +@class RCTRootView; |
| 28 | + |
27 | 29 | @interface RCTTestRunner : NSObject |
28 | 30 |
|
29 | 31 | @property (nonatomic, assign) BOOL recordMode; |
|
59 | 61 |
|
60 | 62 | /** |
61 | 63 | * Same as runTest:, but allows for passing initialProps for providing mock data |
62 | | - * or requesting different behaviors, and expectErrorRegex verifies that the |
63 | | - * error you expected was thrown. |
| 64 | + * or requesting different behaviors, configurationBlock provides arbitrary logic for the hosting |
| 65 | + * root view manipulation. |
| 66 | + * |
| 67 | + * @param test Selector of the test, usually just `_cmd`. |
| 68 | + * @param moduleName Name of the JS component as registered by `AppRegistry.registerComponent` in JS. |
| 69 | + * @param initialProps props that are passed into the component when rendered. |
| 70 | + * @param configurationBlock A block that takes the hosting root view and performs arbitrary manipulation after its creation. |
| 71 | + */ |
| 72 | + |
| 73 | +- (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictionary *)initialProps configurationBlock:(void(^)(RCTRootView *rootView))configurationBlock; |
| 74 | + |
| 75 | +/** |
| 76 | + * Same as runTest:, but allows for passing initialProps for providing mock data |
| 77 | + * or requesting different behaviors, configurationBlock provides arbitrary logic for the hosting |
| 78 | + * root view manipulation, and expectErrorRegex verifies that the error you expected was thrown. |
64 | 79 | * |
65 | 80 | * @param test Selector of the test, usually just `_cmd`. |
66 | 81 | * @param moduleName Name of the JS component as registered by `AppRegistry.registerComponent` in JS. |
67 | 82 | * @param initialProps props that are passed into the component when rendered. |
| 83 | + * @param configurationBlock A block that takes the hosting root view and performs arbitrary manipulation after its creation. |
68 | 84 | * @param expectErrorRegex A regex that must match the error thrown. If no error is thrown, the test fails. |
69 | 85 | */ |
70 | | -- (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictionary *)initialProps expectErrorRegex:(NSString *)expectErrorRegex; |
| 86 | +- (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictionary *)initialProps configurationBlock:(void(^)(RCTRootView *rootView))configurationBlock expectErrorRegex:(NSString *)expectErrorRegex; |
71 | 87 |
|
72 | 88 | /** |
73 | 89 | * Same as runTest:, but allows for passing initialProps for providing mock data |
74 | | - * or requesting different behaviors, and expectErrorBlock provides arbitrary |
| 90 | + * or requesting different behaviors, configurationBlock provides arbitrary logic for the hosting |
| 91 | + * root view manipulation, and expectErrorBlock provides arbitrary |
75 | 92 | * logic for processing errors (nil will cause any error to fail the test). |
76 | 93 | * |
77 | 94 | * @param test Selector of the test, usually just `_cmd`. |
78 | 95 | * @param moduleName Name of the JS component as registered by `AppRegistry.registerComponent` in JS. |
79 | 96 | * @param initialProps props that are passed into the component when rendered. |
| 97 | + * @param configurationBlock A block that takes the hosting root view and performs arbitrary manipulation after its creation. |
80 | 98 | * @param expectErrorBlock A block that takes the error message and returns NO to fail the test. |
81 | 99 | */ |
82 | | -- (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictionary *)initialProps expectErrorBlock:(BOOL(^)(NSString *error))expectErrorBlock; |
| 100 | +- (void)runTest:(SEL)test module:(NSString *)moduleName initialProps:(NSDictionary *)initialProps configurationBlock:(void(^)(RCTRootView *rootView))configurationBlock expectErrorBlock:(BOOL(^)(NSString *error))expectErrorBlock; |
83 | 101 |
|
84 | 102 | @end |
0 commit comments