Be resilient to fn.name not existing in IE
Fixes #516.
Ben Alpert committed
Nov 24, 2013 at 01:53 UTC
685dec022a6d6f71e71e1059ce60f767b301dc3d
1 file changed
+4
-3
src/core/__tests__/ReactPropTypes-test.js
+4
-3
@@ -124,18 +124,19 @@ describe('Instance Types', function() {
124
125
it("should throw for invalid instances", function() {
126
function Person() {}
127
+ var name = Person.name || '<<anonymous>>';
128
129
expect(typeCheck(Props.instanceOf(Person), false)).toThrow(
130
'Invariant Violation: Invalid prop `testProp` supplied to ' +
130
- '`testComponent`, expected instance of `Person`.'
131
+ '`testComponent`, expected instance of `' + name + '`.'
132
);
133
expect(typeCheck(Props.instanceOf(Person), {})).toThrow(
134
'Invariant Violation: Invalid prop `testProp` supplied to ' +
134
- '`testComponent`, expected instance of `Person`.'
135
+ '`testComponent`, expected instance of `' + name + '`.'
136
);
137
expect(typeCheck(Props.instanceOf(Person), '')).toThrow(
138
'Invariant Violation: Invalid prop `testProp` supplied to ' +
138
- '`testComponent`, expected instance of `Person`.'
139
+ '`testComponent`, expected instance of `' + name + '`.'
140
);
141
});
142