diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-11-13 18:46:31 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-11-13 18:53:15 +0100 |
| commit | e331106e56d59a8b987230860b66214139c12ef6 (patch) | |
| tree | 18b595ddd86089b405e9517cd3efc72e2f17a1ab /src/components/organisms/widgets/image-widget.test.tsx | |
| parent | 56878f647ea0f1066fa3e222d7aa0d83057f496d (diff) | |
refactor(components): rewrite ImageWidget component
* remove `imageClassName` prop
* replace `image` prop with `img` and expect an image instead of an
object
* remove `alignment prop`
* remove useless CSS
Diffstat (limited to 'src/components/organisms/widgets/image-widget.test.tsx')
| -rw-r--r-- | src/components/organisms/widgets/image-widget.test.tsx | 55 |
1 files changed, 0 insertions, 55 deletions
diff --git a/src/components/organisms/widgets/image-widget.test.tsx b/src/components/organisms/widgets/image-widget.test.tsx deleted file mode 100644 index 3d48947..0000000 --- a/src/components/organisms/widgets/image-widget.test.tsx +++ /dev/null @@ -1,55 +0,0 @@ -import { describe, expect, it } from '@jest/globals'; -import { render, screen as rtlScreen } from '@testing-library/react'; -import { Heading } from '../../atoms'; -import { ImageWidget } from './image-widget'; - -const description = 'Ut vitae sit'; - -const img = { - alt: 'Et perferendis quaerat', - height: 480, - src: 'http://placeimg.com/640/480/nature', - width: 640, -}; - -const title = 'Fugiat cumque et'; -const titleLevel = 2; - -const url = '/another-page'; - -describe('ImageWidget', () => { - it('renders an image', () => { - render( - <ImageWidget - heading={<Heading level={titleLevel}>{title}</Heading>} - image={img} - /> - ); - expect(rtlScreen.getByRole('img', { name: img.alt })).toBeInTheDocument(); - }); - - it('renders an image with a link', () => { - render( - <ImageWidget - heading={<Heading level={titleLevel}>{title}</Heading>} - image={img} - url={url} - /> - ); - expect(rtlScreen.getByRole('link', { name: img.alt })).toHaveAttribute( - 'href', - url - ); - }); - - it('renders a description', () => { - render( - <ImageWidget - heading={<Heading level={titleLevel}>{title}</Heading>} - image={img} - description={description} - /> - ); - expect(rtlScreen.getByText(description)).toBeInTheDocument(); - }); -}); |
