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/image-widget.test.tsx        | 23 +++++++++-------------
 1 file changed, 9 insertions(+), 14 deletions(-)

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

diff --git a/src/components/organisms/widgets/image-widget.test.tsx b/src/components/organisms/widgets/image-widget.test.tsx
index 7f3ccd8..3d48947 100644
--- a/src/components/organisms/widgets/image-widget.test.tsx
+++ b/src/components/organisms/widgets/image-widget.test.tsx
@@ -1,5 +1,6 @@
 import { describe, expect, it } from '@jest/globals';
-import { render, screen } from '../../../../tests/utils';
+import { render, screen as rtlScreen } from '@testing-library/react';
+import { Heading } from '../../atoms';
 import { ImageWidget } from './image-widget';
 
 const description = 'Ut vitae sit';
@@ -20,26 +21,22 @@ describe('ImageWidget', () => {
   it('renders an image', () => {
     render(
       <ImageWidget
-        expanded={true}
+        heading={<Heading level={titleLevel}>{title}</Heading>}
         image={img}
-        title={title}
-        level={titleLevel}
       />
     );
-    expect(screen.getByRole('img', { name: img.alt })).toBeInTheDocument();
+    expect(rtlScreen.getByRole('img', { name: img.alt })).toBeInTheDocument();
   });
 
-  it('renders a link', () => {
+  it('renders an image with a link', () => {
     render(
       <ImageWidget
-        expanded={true}
+        heading={<Heading level={titleLevel}>{title}</Heading>}
         image={img}
-        title={title}
-        level={titleLevel}
         url={url}
       />
     );
-    expect(screen.getByRole('link', { name: img.alt })).toHaveAttribute(
+    expect(rtlScreen.getByRole('link', { name: img.alt })).toHaveAttribute(
       'href',
       url
     );
@@ -48,13 +45,11 @@ describe('ImageWidget', () => {
   it('renders a description', () => {
     render(
       <ImageWidget
-        expanded={true}
+        heading={<Heading level={titleLevel}>{title}</Heading>}
         image={img}
         description={description}
-        title={title}
-        level={titleLevel}
       />
     );
-    expect(screen.getByText(description)).toBeInTheDocument();
+    expect(rtlScreen.getByText(description)).toBeInTheDocument();
   });
 });
-- 
cgit v1.2.3

