diff --git a/src/core/ReactPropTransferer.js b/src/core/ReactPropTransferer.js index c1f697af4e..691ed58fc8 100644 --- a/src/core/ReactPropTransferer.js +++ b/src/core/ReactPropTransferer.js @@ -44,13 +44,17 @@ function createTransferStrategy(mergeStrategy) { */ var TransferStrategies = { /** - * Never transfer the `ref` prop. + * Never transfer `children`. */ - ref: emptyFunction, + children: emptyFunction, /** * Transfer the `className` prop by merging them. */ className: createTransferStrategy(joinClasses), + /** + * Never transfer the `ref` prop. + */ + ref: emptyFunction, /** * Transfer the `style` prop (which is an object) by merging them. */ diff --git a/src/core/__tests__/ReactCompositeComponentTransferProps-test.js b/src/core/__tests__/ReactCompositeComponentTransferProps-test.js index e32660801f..47cc7455af 100644 --- a/src/core/__tests__/ReactCompositeComponentTransferProps-test.js +++ b/src/core/__tests__/ReactCompositeComponentTransferProps-test.js @@ -51,7 +51,7 @@ describe('ReactCompositeComponent-transferProps', function() { ReactTestUtils.renderIntoDocument(instance); reactComponentExpect(instance) - .expectRenderedChild(instance) + .expectRenderedChild() .toBeDOMComponentWithTag('input') .scalarPropsEqual({ className: 'textinput', @@ -66,7 +66,7 @@ describe('ReactCompositeComponent-transferProps', function() { ReactTestUtils.renderIntoDocument(instance); reactComponentExpect(instance) - .expectRenderedChild(instance) + .expectRenderedChild() .toBeDOMComponentWithTag('input') .scalarPropsEqual({placeholder: 'Type here...'}); }); @@ -80,7 +80,7 @@ describe('ReactCompositeComponent-transferProps', function() { ReactTestUtils.renderIntoDocument(instance); reactComponentExpect(instance) - .expectRenderedChild(instance) + .expectRenderedChild() .toBeDOMComponentWithTag('input') .scalarPropsEqual({ className: 'textinput hidden_elem', @@ -91,6 +91,25 @@ describe('ReactCompositeComponent-transferProps', function() { }); }); + it('should not transfer children', function() { + var ChildrenTestComponent = React.createClass({ + render: function() { + return this.transferPropsTo(
); + } + }); + + var instance = + + Hello! + ; + + ReactTestUtils.renderIntoDocument(instance); + reactComponentExpect(instance) + .expectRenderedChild() + .toBeDOMComponentWithTag('div') + .toBeDOMComponentWithNoChildren(); + }); + it('should not transfer ref', function() { var RefTestComponent = React.createClass({ render: function() {