From f7c4d4cf64036cf10185327596598fc1edc7b102 Mon Sep 17 00:00:00 2001 From: Alex Andreev Date: Fri, 12 Mar 2021 09:58:14 +0300 Subject: [PATCH] Cleaning up Signed-off-by: Alex Andreev --- .../scroll-spy/__tests__/scroll-spy.test.tsx | 24 +++++++++---------- .../components/scroll-spy/scroll-spy.tsx | 11 +++++---- 2 files changed, 18 insertions(+), 17 deletions(-) diff --git a/src/renderer/components/scroll-spy/__tests__/scroll-spy.test.tsx b/src/renderer/components/scroll-spy/__tests__/scroll-spy.test.tsx index 341f786355..512d3251ba 100644 --- a/src/renderer/components/scroll-spy/__tests__/scroll-spy.test.tsx +++ b/src/renderer/components/scroll-spy/__tests__/scroll-spy.test.tsx @@ -39,11 +39,11 @@ describe("", () => { expect(observe).toHaveBeenCalled(); }); - it("renders navigation component", async () => { - const { queryByTestId } = render( ( + it("renders dataTree component", async () => { + const { queryByTestId } = render( (

Application

@@ -74,12 +74,12 @@ describe("", () => { }); -describe(" navigation inside ", () => { +describe(" dataTree inside ", () => { it("contains links to all sections", async () => { - const { queryByTitle } = render( ( + const { queryByTitle } = render( (

Application

@@ -102,10 +102,10 @@ describe(" navigation inside ", () => { }); it("not showing links to sections without id", async () => { - const { queryByTitle } = render( ( + const { queryByTitle } = render( (

Application

@@ -127,10 +127,10 @@ describe(" navigation inside ", () => { }); it("expands parent sections", async () => { - const { queryByTitle } = render( ( + const { queryByTitle } = render( (

Application

@@ -160,10 +160,10 @@ describe(" navigation inside ", () => { }); it("skips sections without headings", async () => { - const { queryByTitle } = render( ( + const { queryByTitle } = render( (

Application

diff --git a/src/renderer/components/scroll-spy/scroll-spy.tsx b/src/renderer/components/scroll-spy/scroll-spy.tsx index e9ab51acc0..9b57368d30 100644 --- a/src/renderer/components/scroll-spy/scroll-spy.tsx +++ b/src/renderer/components/scroll-spy/scroll-spy.tsx @@ -7,6 +7,12 @@ interface Props extends React.DOMAttributes { rootMargin?: string // https://developer.mozilla.org/en-US/docs/Web/API/Intersection_Observer_API#creating_an_intersection_observer } +ScrollSpy.defaultProps = { + // Shrinking root area from the bottom + // Allows to fire observer event only if target scrolled up to top of the page) + rootMargin: "0px 0px -85%" +}; + export function ScrollSpy(props: Props) { const parent = useRef(); const sections = useRef>(); @@ -93,8 +99,3 @@ export function ScrollSpy(props: Props) { ); } -ScrollSpy.defaultProps = { - // Shrinking root area from the bottom - // Allows to fire observer event only if target scrolled up to top of the page) - rootMargin: "0px 0px -85%" -};