From 70b4f633a6fbedb58c8b9134ac64ede854d489de Mon Sep 17 00:00:00 2001
From: Armand Philippot <git@armandphilippot.com>
Date: Mon, 20 Nov 2023 12:27:46 +0100
Subject: 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`
---
 src/components/templates/page/page-layout.test.tsx | 113 ---------------------
 1 file changed, 113 deletions(-)
 delete mode 100644 src/components/templates/page/page-layout.test.tsx

(limited to 'src/components/templates/page/page-layout.test.tsx')

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();
-  });
-});
-- 
cgit v1.2.3

