File tree Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Expand file tree Collapse file tree 2 files changed +19
-0
lines changed Original file line number Diff line number Diff line change @@ -56,6 +56,8 @@ class Position extends React.Component {
56
56
const { children, className, ...props } = this . props ;
57
57
const { positionLeft, positionTop, ...arrowPosition } = this . state ;
58
58
59
+ Object . keys ( Position . propTypes ) . forEach ( key => delete props [ key ] ) ;
60
+
59
61
const child = React . Children . only ( children ) ;
60
62
return cloneElement (
61
63
child ,
Original file line number Diff line number Diff line change @@ -216,5 +216,22 @@ describe('Position', function () {
216
216
} ) ;
217
217
} ) ;
218
218
219
+ it ( 'should not forward own props to child' , function ( ) {
220
+ let spiedProps ;
221
+ const Child = ( props ) => {
222
+ spiedProps = props ;
223
+ return < div /> ;
224
+ } ;
225
+
226
+ ReactTestUtils . renderIntoDocument (
227
+ < Position target = { ( ) => null } childProp = "foo" >
228
+ < Child />
229
+ </ Position >
230
+ ) ;
231
+
232
+ expect ( spiedProps . target ) . to . not . exist ;
233
+ expect ( spiedProps . childProp ) . to . equal ( 'foo' ) ;
234
+ } ) ;
235
+
219
236
// ToDo: add remaining tests
220
237
} ) ;
You can’t perform that action at this time.
0 commit comments