@samitouri / QOS-React-2 / commits / f9947dec2a

Add unit test for transferPropsTo, "key" should never transfer

Andreas Svensson committed Dec 26, 2013 at 16:42 UTC f9947dec2aa5efaf4b3e74392415fff693e8f189
1 file changed +8 -7
src/core/__tests__/ReactPropTransferer-test.js
+8 -7
@@ -110,25 +110,26 @@ describe('ReactPropTransferer', function() {
110 .toBeDOMComponentWithNoChildren();
111 });
112
113 - it('should not transfer ref', function() {
114 - var RefTestComponent = React.createClass({
113 + it('should not transfer ref or key', function() {
114 + var TestComponent = React.createClass({
115 render: function() {
116 expect(this.props.ref).toBeUndefined();
117 + expect(this.props.key).toBeUndefined();
118 return <div />;
119 }
120 });
120 - var OuterRefTestComponent = React.createClass({
121 + var OuterTestComponent = React.createClass({
122 render: function() {
122 - return this.transferPropsTo(<RefTestComponent />);
123 + return this.transferPropsTo(<TestComponent />);
124 }
125 });
125 - var OuterOuterRefTestComponent = React.createClass({
126 + var OuterOuterTestComponent = React.createClass({
127 render: function() {
127 - return <OuterRefTestComponent ref="testref" />;
128 + return <OuterTestComponent ref="testref" key="testkey" />;
129 }
130 });
131
131 - ReactTestUtils.renderIntoDocument(<OuterOuterRefTestComponent />);
132 + ReactTestUtils.renderIntoDocument(<OuterOuterTestComponent />);
133 });
134
135 it('should not transferPropsTo() a component you don\'t own', function() {