diff --git a/plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.test.tsx b/plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.test.tsx index e11b7b6e81..c9339171e3 100644 --- a/plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.test.tsx +++ b/plugins/techdocs/src/reader/components/TechDocsReaderPage/TechDocsReaderPage.test.tsx @@ -91,6 +91,8 @@ const configApi = new MockConfigApi({ }, }); +Element.prototype.scrollIntoView = jest.fn(); + const Wrapper = ({ children }: { children: React.ReactNode }) => { return ( { - if (hashElement) { - if (!isStyleLoading) { - hashElement.scrollIntoView(); - } + if (hashElement && !isStyleLoading) { + hashElement.scrollIntoView(); } else { document?.querySelector('header')?.scrollIntoView(); }