aboutsummaryrefslogtreecommitdiffstats
path: root/src/components/templates/page/page-layout.test.tsx
diff options
context:
space:
mode:
authorArmand Philippot <git@armandphilippot.com>2023-11-20 12:27:46 +0100
committerArmand Philippot <git@armandphilippot.com>2023-11-20 19:32:09 +0100
commit70b4f633a6fbedb58c8b9134ac64ede854d489de (patch)
treec757bb12ad9a588e23b25cdb8b46710ac14dbcb1 /src/components/templates/page/page-layout.test.tsx
parent9a481f066e1427d53a06cf7aeec525a745abf03f (diff)
refactor(components): replace PageLayout template with Page
* split pages in smaller components (it is both easier to maintain and more readable, we avoid the use of fragments in pages directory) * extract breadcrumbs from article tag (the navigation is not related to the page contents) * remove useReadingTime hook * remove layout options except `isHome`
Diffstat (limited to 'src/components/templates/page/page-layout.test.tsx')
-rw-r--r--src/components/templates/page/page-layout.test.tsx113
1 files changed, 0 insertions, 113 deletions
diff --git a/src/components/templates/page/page-layout.test.tsx b/src/components/templates/page/page-layout.test.tsx
deleted file mode 100644
index c7d7a65..0000000
--- a/src/components/templates/page/page-layout.test.tsx
+++ /dev/null
@@ -1,113 +0,0 @@
-import { describe, expect, it } from '@jest/globals';
-import type { BreadcrumbList } from 'schema-dts';
-import { render, screen as rtlScreen } from '../../../../tests/utils';
-import { PageLayout } from './page-layout';
-
-const title = 'Incidunt ad earum';
-const breadcrumb = [
- { id: 'home', url: '#', name: 'Home' },
- { id: 'page', url: '#', name: title },
-];
-const breadcrumbSchema: BreadcrumbList['itemListElement'][] = [];
-const children =
- 'Reprehenderit aut quis aperiam magnam quia id. Vero enim animi placeat quia. Laborum sit odio minima. Dolores et debitis eaque iste quidem. Omnis aliquam illum porro ea non. Quaerat totam iste quos ex facilis officia accusantium.';
-
-describe('PageLayout', () => {
- it('renders the page title', () => {
- render(
- <PageLayout
- breadcrumb={breadcrumb}
- breadcrumbSchema={breadcrumbSchema}
- title={title}
- >
- {children}
- </PageLayout>
- );
- expect(
- rtlScreen.getByRole('heading', { level: 1, name: title })
- ).toBeInTheDocument();
- });
-
- it('renders the page content', () => {
- render(
- <PageLayout
- breadcrumb={breadcrumb}
- breadcrumbSchema={breadcrumbSchema}
- title={title}
- >
- {children}
- </PageLayout>
- );
- expect(rtlScreen.getByText(children)).toBeInTheDocument();
- });
-
- it('renders the breadcrumb', () => {
- render(
- <PageLayout
- breadcrumb={breadcrumb}
- breadcrumbSchema={breadcrumbSchema}
- title={title}
- >
- {children}
- </PageLayout>
- );
- expect(
- rtlScreen.getByRole('navigation', { name: 'Breadcrumb' })
- ).toBeInTheDocument();
- });
-
- it('renders the table of contents', () => {
- render(
- <PageLayout
- breadcrumb={breadcrumb}
- breadcrumbSchema={breadcrumbSchema}
- title={title}
- withToC={true}
- >
- {children}
- </PageLayout>
- );
- expect(rtlScreen.getByText(/Table of Contents/i)).toBeInTheDocument();
- });
-
- it('renders the comment form', () => {
- render(
- <PageLayout
- breadcrumb={breadcrumb}
- breadcrumbSchema={breadcrumbSchema}
- title={title}
- allowComments={true}
- >
- {children}
- </PageLayout>
- );
- expect(
- rtlScreen.getByRole('form', { name: /Comment form/i })
- ).toBeInTheDocument();
- });
-
- it('renders the comments list', () => {
- render(
- <PageLayout
- breadcrumb={breadcrumb}
- breadcrumbSchema={breadcrumbSchema}
- title={title}
- allowComments={true}
- comments={[
- {
- author: { name: 'Burley40' },
- content: 'Veritatis praesentium non autem ut.',
- id: 1,
- isApproved: true,
- publicationDate: '2023-11-02',
- },
- ]}
- >
- {children}
- </PageLayout>
- );
- expect(
- rtlScreen.getByRole('heading', { level: 2, name: /Comments/i })
- ).toBeInTheDocument();
- });
-});