test: scroll

ref: N25B-292
This commit is contained in:
JobvAlewijk
2025-12-02 11:36:10 +01:00
parent 2261da9915
commit d4393e7635

View File

@@ -0,0 +1,14 @@
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' });
});