test: scroll
ref: N25B-292
This commit is contained in:
@@ -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' });
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user