Skip to content

Commit

Permalink
add test case
Browse files Browse the repository at this point in the history
  • Loading branch information
oliviertassinari committed Dec 27, 2019
1 parent 6632abd commit 7267279
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions packages/material-ui/src/Slider/Slider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -409,27 +409,41 @@ describe('<Slider />', () => {
const marks = [{ value: 5 }, { value: 10 }, { value: 15 }];

const { container: container1 } = render(
<Slider disabled min={0} max={20} value={12} marks={marks} />,
<Slider min={0} max={20} value={12} marks={marks} />,
);
expect(getActives(container1)).to.deep.equal([true, true, false]);

const { container: container2 } = render(
<Slider disabled min={0} max={20} value={[8, 12]} marks={marks} />,
<Slider min={0} max={20} value={[8, 12]} marks={marks} />,
);
expect(getActives(container2)).to.deep.equal([false, true, false]);
});

it('uses closed intervals for the within check', () => {
const { container: container1 } = render(
<Slider disabled value={10} min={0} max={10} marks step={5} />,
<Slider value={10} min={0} max={10} marks step={5} />,
);
expect(getActives(container1)).to.deep.equal([true, true, true]);

const { container: container2 } = render(
<Slider disabled value={9.99999} min={0} max={10} marks step={5} />,
<Slider value={9.99999} min={0} max={10} marks step={5} />,
);
expect(getActives(container2)).to.deep.equal([true, true, false]);
});

it('should support inverted track', () => {
const marks = [{ value: 5 }, { value: 10 }, { value: 15 }];

const { container: container1 } = render(
<Slider min={0} max={20} value={12} marks={marks} track="inverted" />,
);
expect(getActives(container1)).to.deep.equal([false, false, true]);

const { container: container2 } = render(
<Slider min={0} max={20} value={[8, 12]} marks={marks} track="inverted" />,
);
expect(getActives(container2)).to.deep.equal([true, false, true]);
});
});

it('should forward mouseDown', () => {
Expand Down

0 comments on commit 7267279

Please sign in to comment.