From be4d907efb4e2fa658baa7c9b276ed282eb920db Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Tue, 14 Nov 2023 19:07:14 +0100
Subject: refactor(components, hooks): rewrite ToC and useHeadingsTree

* replace TableOfContents component with TocWidget to keep the name of
widget components coherent
* replace `wrapper` prop with `tree` prop (the component no longer uses
the hook, it is up to the consumer to provide the headings tree)
* let consumer handle the widget title
* add options to useHeadingsTree hook to retrieve only the wanted
headings (and do not assume that h1 is unwanted)
* expect an ref object instead of an element in useHeadingsTree hook
* rename most of the types involved
---
 src/components/organisms/widgets/table-of-contents.test.tsx | 11 -----------
 1 file changed, 11 deletions(-)
 delete mode 100644 src/components/organisms/widgets/table-of-contents.test.tsx

(limited to 'src/components/organisms/widgets/table-of-contents.test.tsx')

diff --git a/src/components/organisms/widgets/table-of-contents.test.tsx b/src/components/organisms/widgets/table-of-contents.test.tsx
deleted file mode 100644
index f5b2a87..0000000
--- a/src/components/organisms/widgets/table-of-contents.test.tsx
+++ /dev/null
@@ -1,11 +0,0 @@
-import { describe, expect, it } from '@jest/globals';
-import { render, screen as rtlScreen } from '../../../../tests/utils';
-import { TableOfContents } from './table-of-contents';
-
-describe('TableOfContents', () => {
-  it('renders a title', () => {
-    const divEl = document.createElement('div');
-    render(<TableOfContents wrapper={divEl} />);
-    expect(rtlScreen.getByText(/Table of Contents/i)).toBeInTheDocument();
-  });
-});
-- 
cgit v1.2.3

