Fix PropTypes test in IE10
Test Plan: Ran the test in jest, phantomjs, IE10, Chrome, and Firefox.
Ben Alpert committed
Jun 7, 2014 at 18:56 UTC
7cd5e9b399b32daf3f4b1c494cfb4587067360eb
1 file changed
+8
-5
src/core/__tests__/ReactPropTypes-test.js
+8
-5
@@ -274,36 +274,39 @@ describe('Component Type', function() {
274
describe('Instance Types', function() {
275
it("should warn for invalid instances", function() {
276
function Person() {}
277
+ var personName = Person.name || '<<anonymous>>';
278
+ var dateName = Date.name || '<<anonymous>>';
279
+ var regExpName = RegExp.name || '<<anonymous>>';
280
281
typeCheckFail(
282
PropTypes.instanceOf(Person),
283
false,
284
'Invalid prop `testProp` supplied to `testComponent`, expected ' +
282
- 'instance of `Person`.'
285
+ 'instance of `' + personName + '`.'
286
);
287
typeCheckFail(
288
PropTypes.instanceOf(Person),
289
{},
290
'Invalid prop `testProp` supplied to `testComponent`, expected ' +
288
- 'instance of `Person`.'
291
+ 'instance of `' + personName + '`.'
292
);
293
typeCheckFail(
294
PropTypes.instanceOf(Person),
295
'',
296
'Invalid prop `testProp` supplied to `testComponent`, expected ' +
294
- 'instance of `Person`.'
297
+ 'instance of `' + personName + '`.'
298
);
299
typeCheckFail(
300
PropTypes.instanceOf(Date),
301
{},
302
'Invalid prop `testProp` supplied to `testComponent`, expected ' +
300
- 'instance of `Date`.'
303
+ 'instance of `' + dateName + '`.'
304
);
305
typeCheckFail(
306
PropTypes.instanceOf(RegExp),
307
{},
308
'Invalid prop `testProp` supplied to `testComponent`, expected ' +
306
- 'instance of `RegExp`.'
309
+ 'instance of `' + regExpName + '`.'
310
);
311
});
312