aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/molecules/layout/branding.test.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-10-09 16:31:00 +0200
committerArmand Philippot <git@armandphilippot.com>2023-11-11 18:14:41 +0100
commit891441a76173c708c6604fa203b175aefa222333 (patch)
tree27295311bb01a4e44dcc4f68422975cd705a24b8 /src/components/molecules/layout/branding.test.tsx
parentf11a906420975e833f278a08470d8f9783c76f73 (diff)
refactor(components): rewrite Branding component
The component should only be responsible of the layout for the logo, the name and the optional baseline. Also, the homepage url could be different from `/` so the consumer should give the right url.
Diffstat (limited to 'src/components/molecules/layout/branding.test.tsx')
-rw-r--r--src/components/molecules/layout/branding.test.tsx109
1 files changed, 0 insertions, 109 deletions
diff --git a/src/components/molecules/layout/branding.test.tsx b/src/components/molecules/layout/branding.test.tsx
deleted file mode 100644
index cfb55c5..0000000
--- a/src/components/molecules/layout/branding.test.tsx
+++ /dev/null
@@ -1,109 +0,0 @@
-import { describe, expect, it } from '@jest/globals';
-import NextImage from 'next/image';
-import { render, screen as rtlScreen } from '../../../../tests/utils';
-import { Logo } from '../../atoms';
-import { Branding } from './branding';
-
-describe('Branding', () => {
- it('renders a photo', () => {
- const altText = 'A photo example';
-
- render(
- <Branding
- logo={<Logo />}
- photo={
- <NextImage
- alt="A photo example"
- height={200}
- src="https://picsum.photos/200"
- width={200}
- />
- }
- title="Website title"
- />
- );
- expect(rtlScreen.getByRole('img', { name: altText })).toBeInTheDocument();
- });
-
- it('renders a logo', () => {
- const logoHeading = 'sed enim voluptatem';
-
- render(
- <Branding
- logo={<Logo heading={logoHeading} />}
- photo={
- <NextImage
- alt="A photo example"
- height={200}
- src="https://picsum.photos/200"
- width={200}
- />
- }
- title="Website name"
- />
- );
- expect(rtlScreen.getByTitle(logoHeading)).toBeInTheDocument();
- });
-
- it('renders a baseline', () => {
- render(
- <Branding
- logo={<Logo />}
- photo={
- <NextImage
- alt="A photo example"
- height={200}
- src="https://picsum.photos/200"
- width={200}
- />
- }
- title="Website title"
- baseline="Website baseline"
- />
- );
- expect(rtlScreen.getByText('Website baseline')).toBeInTheDocument();
- });
-
- it('renders a title wrapped with h1 element', () => {
- render(
- <Branding
- logo={<Logo />}
- photo={
- <NextImage
- alt="A photo example"
- height={200}
- src="https://picsum.photos/200"
- width={200}
- />
- }
- title="Website title"
- isHome={true}
- />
- );
- expect(
- rtlScreen.getByRole('heading', { level: 1, name: 'Website title' })
- ).toBeInTheDocument();
- });
-
- it('renders a title with h1 styles', () => {
- render(
- <Branding
- logo={<Logo />}
- photo={
- <NextImage
- alt="A photo example"
- height={200}
- src="https://picsum.photos/200"
- width={200}
- />
- }
- title="Website title"
- isHome={false}
- />
- );
- expect(
- rtlScreen.queryByRole('heading', { level: 1, name: 'Website title' })
- ).not.toBeInTheDocument();
- expect(rtlScreen.getByText('Website title')).toHaveClass('heading--1');
- });
-});