File tree Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Expand file tree Collapse file tree 1 file changed +32
-0
lines changed Original file line number Diff line number Diff line change @@ -178,6 +178,38 @@ var ReactTestUtils = {
178
178
return constructor === type ;
179
179
} ,
180
180
181
+ // TODO: deprecate? It's undocumented and unused.
182
+ isCompositeComponentElement : function ( inst ) {
183
+ if ( ! React . isValidElement ( inst ) ) {
184
+ return false ;
185
+ }
186
+ // We check the prototype of the type that will get mounted, not the
187
+ // instance itself. This is a future proof way of duck typing.
188
+ var prototype = inst . type . prototype ;
189
+ return (
190
+ typeof prototype . render === 'function' &&
191
+ typeof prototype . setState === 'function'
192
+ ) ;
193
+ } ,
194
+
195
+ // TODO: deprecate? It's undocumented and unused.
196
+ isCompositeComponentElementWithType : function ( inst , type ) {
197
+ var internalInstance = ReactInstanceMap . get ( inst ) ;
198
+ var constructor = internalInstance . _currentElement . type ;
199
+
200
+ return ! ! ( ReactTestUtils . isCompositeComponentElement ( inst ) &&
201
+ constructor === type ) ;
202
+ } ,
203
+
204
+ // TODO: deprecate? It's undocumented and unused.
205
+ getRenderedChildOfCompositeComponent : function ( inst ) {
206
+ if ( ! ReactTestUtils . isCompositeComponent ( inst ) ) {
207
+ return null ;
208
+ }
209
+ var internalInstance = ReactInstanceMap . get ( inst ) ;
210
+ return internalInstance . _renderedComponent . getPublicInstance ( ) ;
211
+ } ,
212
+
181
213
findAllInRenderedTree : function ( inst , test ) {
182
214
if ( ! inst ) {
183
215
return [ ] ;
You can’t perform that action at this time.
0 commit comments