Skip to content

Commit

Permalink
Revert "Remove undocumented TestUtils methods (facebook#10681)"
Browse files Browse the repository at this point in the history
This reverts commit 18d6cb5.
  • Loading branch information
danseethaler committed Sep 13, 2017
1 parent 65b9ad9 commit 13c56c1
Showing 1 changed file with 32 additions and 0 deletions.
32 changes: 32 additions & 0 deletions src/renderers/dom/test/ReactTestUtilsEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,38 @@ var ReactTestUtils = {
return constructor === type;
},

// TODO: deprecate? It's undocumented and unused.
isCompositeComponentElement: function(inst) {
if (!React.isValidElement(inst)) {
return false;
}
// We check the prototype of the type that will get mounted, not the
// instance itself. This is a future proof way of duck typing.
var prototype = inst.type.prototype;
return (
typeof prototype.render === 'function' &&
typeof prototype.setState === 'function'
);
},

// TODO: deprecate? It's undocumented and unused.
isCompositeComponentElementWithType: function(inst, type) {
var internalInstance = ReactInstanceMap.get(inst);
var constructor = internalInstance._currentElement.type;

return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
constructor === type);
},

// TODO: deprecate? It's undocumented and unused.
getRenderedChildOfCompositeComponent: function(inst) {
if (!ReactTestUtils.isCompositeComponent(inst)) {
return null;
}
var internalInstance = ReactInstanceMap.get(inst);
return internalInstance._renderedComponent.getPublicInstance();
},

findAllInRenderedTree: function(inst, test) {
if (!inst) {
return [];
Expand Down

0 comments on commit 13c56c1

Please sign in to comment.