2022-05-06 21:13:51 +03:00
|
|
|
import { render, screen } from '@testing-library/react';
|
2023-05-27 12:57:26 +03:00
|
|
|
import { MemoryRouter } from 'react-router';
|
2022-05-06 21:13:51 +03:00
|
|
|
import { ScrollToTop } from '../../src/common/ScrollToTop';
|
2023-09-30 11:20:28 +03:00
|
|
|
import { checkAccessibility } from '../__helpers__/accessibility';
|
2022-02-08 00:17:57 +03:00
|
|
|
|
2020-08-29 10:19:15 +03:00
|
|
|
describe('<ScrollToTop />', () => {
|
2023-09-30 11:20:28 +03:00
|
|
|
const setUp = (children = 'Foo') => render(<MemoryRouter><ScrollToTop>{children}</ScrollToTop></MemoryRouter>);
|
|
|
|
|
|
|
|
it('passes a11y checks', () => checkAccessibility(setUp()));
|
|
|
|
|
2022-05-06 21:13:51 +03:00
|
|
|
it.each([
|
|
|
|
['Foobar'],
|
|
|
|
['Barfoo'],
|
|
|
|
['Something'],
|
|
|
|
])('just renders children', (children) => {
|
2023-09-30 11:20:28 +03:00
|
|
|
setUp(children);
|
2022-05-06 21:13:51 +03:00
|
|
|
expect(screen.getByText(children)).toBeInTheDocument();
|
2020-08-29 10:19:15 +03:00
|
|
|
});
|
|
|
|
});
|