Skip to content

fix(Slider): do not pass infinite to div #208

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 14, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 7 additions & 2 deletions src/Slider/Slider.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -613,8 +613,13 @@ const Slider = class Slider extends React.Component {

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

// remove `dragStep` and `step` from Slider div, since it isn't a valid html attribute
const { dragStep, step, ...rest } = props;
// remove invalid div attributes
const {
dragStep,
step,
infinite,
...rest
} = props;

// filter out some tray props before passing them in. We will process event handlers in the
// trayProps object as callbacks to OUR event handlers. Ref is needed by us. Style and
Expand Down
8 changes: 8 additions & 0 deletions src/Slider/__tests__/Slider.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -1047,5 +1047,13 @@ describe('<Slider />', () => {
instance.unlockScroll();
expect(instance.scrollParent).toEqual(null);
});

it('should not pass invalid props to div', () => {
const wrapper = shallow(<Slider {...props} />);
const divProps = wrapper.closest('div').props();
expect(divProps.dragStep).toBeUndefined();
expect(divProps.step).toBeUndefined();
expect(divProps.infinite).toBeUndefined();
});
});
});