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 {
5656 const { children, className, ...props } = this . props ;
5757 const { positionLeft, positionTop, ...arrowPosition } = this . state ;
5858
59+ Object . keys ( Position . propTypes ) . forEach ( key => delete props [ key ] ) ;
60+
5961 const child = React . Children . only ( children ) ;
6062 return cloneElement (
6163 child ,
Original file line number Diff line number Diff line change @@ -216,5 +216,22 @@ describe('Position', function () {
216216 } ) ;
217217 } ) ;
218218
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+
219236 // ToDo: add remaining tests
220237} ) ;
You can’t perform that action at this time.
0 commit comments