Files
pepperplus-ui/test/pages/visProgPage/visualProgrammingUI/components/ScrollIntoView.test.tsx
2025-12-07 15:32:20 +00:00

15 lines
437 B
TypeScript

import { render } from '@testing-library/react';
import { act } from '@testing-library/react';
import ScrollIntoView from '../../../../../src/components/ScrollIntoView';
test('scrolls the element into view on render', () => {
const scrollMock = jest.fn();
HTMLElement.prototype.scrollIntoView = scrollMock;
act(() => {
render(<ScrollIntoView />);
});
expect(scrollMock).toHaveBeenCalledWith({ behavior: 'smooth' });
});