Skip to content

Commit

Permalink
fix: onAfterChange should called with number if not range (#824)
Browse files Browse the repository at this point in the history
  • Loading branch information
MadCcc committed Mar 24, 2022
1 parent a05295d commit 9332abe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Slider.tsx
Expand Up @@ -299,7 +299,7 @@ const Slider = React.forwardRef((props: SliderProps, ref: React.Ref<SliderRef>)
}

triggerChange(cloneNextValues);
onAfterChange?.(cloneNextValues);
onAfterChange?.(getTriggerValue(cloneNextValues));
}
};

Expand Down
9 changes: 9 additions & 0 deletions tests/Slider.test.js
Expand Up @@ -580,4 +580,13 @@ describe('Slider', () => {
fireEvent.keyDown(container.querySelector('.rc-slider-handle'), { keyCode: keyCode.RIGHT });
expect(onChange).toHaveBeenCalledWith(0.82);
});

it('onAfterChange should return number', () => {
const onAfterChange = jest.fn();
const { container } = render(<Slider onAfterChange={onAfterChange} />);
fireEvent.mouseDown(container.querySelector('.rc-slider'), {
clientX: 20,
});
expect(onAfterChange).toHaveBeenCalledWith(20);
});
});

1 comment on commit 9332abe

@vercel
Copy link

@vercel vercel bot commented on 9332abe Mar 24, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.