From ba793e043e4d8515b1a9ea490ee2c5f92b1fd6c2 Mon Sep 17 00:00:00 2001 From: Armand Philippot Date: Wed, 27 Sep 2023 15:40:16 +0200 Subject: refactor(components): rewrite Section component * Make it compliant with ESlint rules * Remove mandatory heading, it now depends on the consumer * Change defaults for hasBorder and variant --- .../templates/sectioned/sectioned-layout.test.tsx | 33 ++++------------------ 1 file changed, 6 insertions(+), 27 deletions(-) (limited to 'src/components/templates/sectioned/sectioned-layout.test.tsx') diff --git a/src/components/templates/sectioned/sectioned-layout.test.tsx b/src/components/templates/sectioned/sectioned-layout.test.tsx index 2370337..372b0fb 100644 --- a/src/components/templates/sectioned/sectioned-layout.test.tsx +++ b/src/components/templates/sectioned/sectioned-layout.test.tsx @@ -1,31 +1,10 @@ import { describe, expect, it } from '@jest/globals'; -import { BreadcrumbList } from 'schema-dts'; -import { render, screen } from '../../../../tests/utils'; +import type { BreadcrumbList } from 'schema-dts'; +import { render, screen as rtlScreen } from '../../../../tests/utils'; import { SectionedLayout } from './sectioned-layout'; +import { sections } from './sectioned-layout.fixtures'; const breadcrumbSchema: BreadcrumbList['itemListElement'][] = []; -const sections = [ - { - title: 'Section 1', - content: - 'Qui suscipit ea et aut dicta. Quia ut dignissimos. Sapiente beatae voluptatem quis et. Nemo vitae magni. Nihil iste officia est sed esse molestiae doloribus. Quia temporibus nobis ea fuga quis incidunt doloribus eaque.', - }, - { - title: 'Section 2', - content: - 'Reprehenderit aut magnam ut quos. Voluptatibus beatae et. Earum non atque voluptatum illum rem distinctio repellat.', - }, - { - title: 'Section 3', - content: - 'Placeat rem dolores dolore illum earum officia dolore. Ut est ducimus. Officia eveniet pariatur ut laboriosam voluptatibus aut doloremque natus quis.', - }, - { - title: 'Section 4', - content: - 'Vitae facere ipsa eum sunt debitis veritatis dolorem labore qui. Dolores recusandae omnis aut. Repudiandae quia neque porro in blanditiis. A atque minima fugit. Totam quidem voluptas natus velit at.', - }, -]; describe('SectionedLayout', () => { it('renders the correct number of section', () => { @@ -35,8 +14,8 @@ describe('SectionedLayout', () => { sections={sections} /> ); - expect(screen.getAllByRole('heading', { name: /^Section/ })).toHaveLength( - sections.length - ); + expect( + rtlScreen.getAllByRole('heading', { name: /^Section/ }) + ).toHaveLength(sections.length); }); }); -- cgit v1.2.3