From 12a03a9a72f7895d571dbaeeb245d92aa277a610 Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Fri, 6 Oct 2023 17:48:03 +0200
Subject: refactor(components): merge HeadingButton and Widget components

The HeadingButton component was only used inside Widget component and
it is not very useful on its own so I merge the two components in a
new Collapsible component.
---
 .../organisms/widgets/links-list-widget.test.tsx   | 34 ++++++++++++++++++----
 1 file changed, 29 insertions(+), 5 deletions(-)

(limited to 'src/components/organisms/widgets/links-list-widget.test.tsx')

diff --git a/src/components/organisms/widgets/links-list-widget.test.tsx b/src/components/organisms/widgets/links-list-widget.test.tsx
index 6323e19..2a914e7 100644
--- a/src/components/organisms/widgets/links-list-widget.test.tsx
+++ b/src/components/organisms/widgets/links-list-widget.test.tsx
@@ -1,5 +1,6 @@
 import { describe, expect, it } from '@jest/globals';
-import { render, screen as rtlScreen } from '../../../../tests/utils';
+import { render, screen as rtlScreen } from '@testing-library/react';
+import { Heading } from '../../atoms';
 import { LinksListWidget } from './links-list-widget';
 
 const title = 'Voluptatem minus autem';
@@ -12,19 +13,42 @@ const items = [
 
 describe('LinksListWidget', () => {
   it('renders a widget title', () => {
-    render(<LinksListWidget items={items} title={title} level={2} />);
+    render(
+      <LinksListWidget
+        heading={<Heading level={3}>{title}</Heading>}
+        items={items}
+      />
+    );
     expect(
-      rtlScreen.getByRole('heading', { level: 2, name: new RegExp(title, 'i') })
+      rtlScreen.getByRole('heading', { level: 3, name: new RegExp(title, 'i') })
     ).toBeInTheDocument();
   });
 
   it('renders the correct number of items', () => {
-    render(<LinksListWidget items={items} title={title} level={2} />);
+    render(
+      <LinksListWidget
+        heading={
+          <Heading isFake level={3}>
+            {title}
+          </Heading>
+        }
+        items={items}
+      />
+    );
     expect(rtlScreen.getAllByRole('listitem')).toHaveLength(items.length);
   });
 
   it('renders some links', () => {
-    render(<LinksListWidget items={items} title={title} level={2} />);
+    render(
+      <LinksListWidget
+        heading={
+          <Heading isFake level={3}>
+            {title}
+          </Heading>
+        }
+        items={items}
+      />
+    );
     expect(
       rtlScreen.getByRole('link', { name: items[0].name })
     ).toHaveAttribute('href', items[0].url);
-- 
cgit v1.2.3

