Assert instance type using internal constructor
Tim Routowicz committed
May 22, 2015 at 11:37 UTC
f1e32a06e0933ec3fab7baaa5731a18568f1ac39
1 file changed
+12
-2
src/test/ReactTestUtils.js
+12
-2
@@ -82,8 +82,13 @@ var ReactTestUtils = {
82
},
83
84
isCompositeComponentWithType: function(inst, type) {
85
+ var internalInstance = ReactInstanceMap.get(inst);
86
+ var constructor = internalInstance
87
+ ._currentElement
88
+ .type;
89
+
90
return !!(ReactTestUtils.isCompositeComponent(inst) &&
86
- (inst.constructor === type));
91
+ (constructor === type));
92
},
93
94
isCompositeComponentElement: function(inst) {
@@ -100,8 +105,13 @@ var ReactTestUtils = {
105
},
106
107
isCompositeComponentElementWithType: function(inst, type) {
108
+ var internalInstance = ReactInstanceMap.get(inst);
109
+ var constructor = internalInstance
110
+ ._currentElement
111
+ .type;
112
+
113
return !!(ReactTestUtils.isCompositeComponentElement(inst) &&
104
- (inst.constructor === type));
114
+ (constructor === type));
115
},
116
117
getRenderedChildOfCompositeComponent: function(inst) {