Skip to content

Commit 2d54df8

Browse files
committed
fix(Slider): do not pass infinite to div
1 parent 543b2f0 commit 2d54df8

File tree

2 files changed

+15
-2
lines changed

2 files changed

+15
-2
lines changed

src/Slider/Slider.jsx

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -613,8 +613,13 @@ const Slider = class Slider extends React.Component {
613613

614614
const newTabIndex = tabIndex !== null ? tabIndex : 0;
615615

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;
618623

619624
// filter out some tray props before passing them in. We will process event handlers in the
620625
// trayProps object as callbacks to OUR event handlers. Ref is needed by us. Style and

src/Slider/__tests__/Slider.test.jsx

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1047,5 +1047,13 @@ describe('<Slider />', () => {
10471047
instance.unlockScroll();
10481048
expect(instance.scrollParent).toEqual(null);
10491049
});
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+
});
10501058
});
10511059
});

0 commit comments

Comments
 (0)