Fix ReactPropTypesTest
children should never be defined as propType, so changing the test to use an actual prop.
Christoph Pojer committed
Mar 3, 2014 at 09:38 UTC
3fe9f9f336255bcf67f5a6551317545d35b4b283
1 file changed
+5
-18
src/core/__tests__/ReactPropTypes-test.js
+5
-18
@@ -445,36 +445,23 @@ describe('Component Type', function() {
445
446
var Component = React.createClass({
447
propTypes: {
448
- children: Props.component.isRequired
448
+ label: Props.component.isRequired
449
},
450
451
render: function() {
452
- return <div>{this.props.children}</div>;
452
+ return <div>{this.props.label}</div>;
453
}
454
});
455
456
- it('should be able to define a single child as children', () => {
457
- var instance =
458
- <Component>
459
- <div />
460
- </Component>;
456
+ it('should be able to define a single child as label', () => {
457
+ var instance = <Component label={<div />} />;
458
ReactTestUtils.renderIntoDocument(instance);
459
460
// No warnings should have been logged.
461
expect(console.warn.mock.calls.length).toBe(0);
462
});
463
467
- it('should warn when passing more than one child', () => {
468
- var instance =
469
- <Component>
470
- <div />
471
- <div />
472
- </Component>;
473
- ReactTestUtils.renderIntoDocument(instance);
474
- expect(console.warn.mock.calls.length).toBe(1);
475
- });
476
-
477
- it('should warn when passing no children and isRequired is set', () => {
464
+ it('should warn when passing no label and isRequired is set', () => {
465
var instance = <Component />;
466
ReactTestUtils.renderIntoDocument(instance);
467