shlink-web-client/test/common/ScrollToTop.test.tsx

20 lines
645 B
TypeScript
Raw Normal View History

import { render, screen } from '@testing-library/react';
2023-05-27 12:57:26 +03:00
import { MemoryRouter } from 'react-router';
import { ScrollToTop } from '../../src/common/ScrollToTop';
2023-09-30 11:20:28 +03:00
import { checkAccessibility } from '../__helpers__/accessibility';
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()));
it.each([
['Foobar'],
['Barfoo'],
['Something'],
])('just renders children', (children) => {
2023-09-30 11:20:28 +03:00
setUp(children);
expect(screen.getByText(children)).toBeInTheDocument();
});
});