Skip to content

Commit

Permalink
chore: test case
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Nov 30, 2023
1 parent 4773b24 commit 331d28f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion tests/Slider.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,13 +188,21 @@ describe('Slider', () => {

it('decreases the value when key "left" is pressed', () => {
const onChange = jest.fn();
const { container } = render(<Slider defaultValue={50} onChange={onChange} />);
const onChangeComplete = jest.fn();
const { container } = render(<Slider defaultValue={50} onChange={onChange} onAfterChange={onChangeComplete} />);

fireEvent.keyDown(container.getElementsByClassName('rc-slider-handle')[0], {
keyCode: keyCode.LEFT,
});

expect(onChange).toHaveBeenCalledWith(49);
expect(onChangeComplete).not.toHaveBeenCalled();

fireEvent.keyUp(container.getElementsByClassName('rc-slider-handle')[0], {
keyCode: keyCode.LEFT,
});

expect(onChangeComplete).toHaveBeenCalled();
});

it('it should work fine when arrow key is pressed', () => {
Expand Down

0 comments on commit 331d28f

Please sign in to comment.