aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/organisms/widgets/image-widget.test.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-06 17:48:03 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit12a03a9a72f7895d571dbaeeb245d92aa277a610 (patch)
tree41b6b07928e4f5e101b7ea5d8389bb4325bbac76 /src/components/organisms/widgets/image-widget.test.tsx
parentfb860884857da73ee5b5e897745301cdf1d770a2 (diff)
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.
Diffstat (limited to 'src/components/organisms/widgets/image-widget.test.tsx')
-rw-r--r--src/components/organisms/widgets/image-widget.test.tsx23
1 files changed, 9 insertions, 14 deletions
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();
});
});