File tree Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Expand file tree Collapse file tree 2 files changed +15
-2
lines changed Original file line number Diff line number Diff line change @@ -613,8 +613,13 @@ const Slider = class Slider extends React.Component {
613
613
614
614
const newTabIndex = tabIndex !== null ? tabIndex : 0 ;
615
615
616
- // remove `dragStep` and `step` from Slider div, since it isn't a valid html attribute
617
- const { dragStep, step, ...rest } = props ;
616
+ // remove invalid div attributes
617
+ const {
618
+ dragStep,
619
+ step,
620
+ infinite,
621
+ ...rest
622
+ } = props ;
618
623
619
624
// filter out some tray props before passing them in. We will process event handlers in the
620
625
// trayProps object as callbacks to OUR event handlers. Ref is needed by us. Style and
Original file line number Diff line number Diff line change @@ -1047,5 +1047,13 @@ describe('<Slider />', () => {
1047
1047
instance . unlockScroll ( ) ;
1048
1048
expect ( instance . scrollParent ) . toEqual ( null ) ;
1049
1049
} ) ;
1050
+
1051
+ it ( 'should not pass invalid props to div' , ( ) => {
1052
+ const wrapper = shallow ( < Slider { ...props } /> ) ;
1053
+ const divProps = wrapper . closest ( 'div' ) . props ( ) ;
1054
+ expect ( divProps . dragStep ) . toBeUndefined ( ) ;
1055
+ expect ( divProps . step ) . toBeUndefined ( ) ;
1056
+ expect ( divProps . infinite ) . toBeUndefined ( ) ;
1057
+ } ) ;
1050
1058
} ) ;
1051
1059
} ) ;
You can’t perform that action at this time.
0 commit comments