18 lines
666 B
TypeScript
18 lines
666 B
TypeScript
// This program has been developed by students from the bachelor Computer Science at Utrecht
|
|
// University within the Software Project course.
|
|
// © Copyright Utrecht University (Department of Information and Computing Sciences)
|
|
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' });
|
|
});
|