mirror of
https://github.com/reduxjs/redux-devtools.git
synced 2024-11-27 12:03:56 +03:00
922985f9ea
* chore(deps): update dependency prettier to v3 * Format --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Nathan Bierema <nbierema@gmail.com>
42 lines
985 B
TypeScript
42 lines
985 B
TypeScript
import React from 'react';
|
|
import { fireEvent, render, screen } from '@testing-library/react';
|
|
import { Slider } from '../src';
|
|
|
|
describe('Slider', function () {
|
|
it('renders correctly', () => {
|
|
const { container } = render(
|
|
<Slider
|
|
onChange={() => {
|
|
// noop
|
|
}}
|
|
/>,
|
|
);
|
|
expect(container.firstChild).toMatchSnapshot();
|
|
});
|
|
|
|
it('renders with props', () => {
|
|
const { container } = render(
|
|
<Slider
|
|
label="Hi"
|
|
min={1}
|
|
max={10}
|
|
value={5}
|
|
disabled
|
|
onChange={() => {
|
|
// noop
|
|
}}
|
|
/>,
|
|
);
|
|
expect(container.firstChild).toMatchSnapshot();
|
|
});
|
|
|
|
it('should handle the change event', () => {
|
|
const onChange = jest.fn();
|
|
render(<Slider value={1} onChange={onChange} />);
|
|
|
|
fireEvent.change(screen.getByRole('slider'), { target: { value: '2' } });
|
|
expect(onChange).toHaveBeenCalled();
|
|
expect(onChange).toHaveBeenCalledWith(2);
|
|
});
|
|
});
|