From 5388ba12f4801fc2114d8eff3547dcc91ca6d2b8 Mon Sep 17 00:00:00 2001 From: mfrances Date: Thu, 5 Oct 2023 16:17:34 -0400 Subject: [PATCH] chore(Divider): update tests to new standards --- .../Divider/__tests__/Divider.test.tsx | 112 ++++++++++++++---- .../__snapshots__/Divider.test.tsx.snap | 42 +------ 2 files changed, 89 insertions(+), 65 deletions(-) diff --git a/packages/react-core/src/components/Divider/__tests__/Divider.test.tsx b/packages/react-core/src/components/Divider/__tests__/Divider.test.tsx index 6b940d6841c..53c07ba172b 100644 --- a/packages/react-core/src/components/Divider/__tests__/Divider.test.tsx +++ b/packages/react-core/src/components/Divider/__tests__/Divider.test.tsx @@ -1,34 +1,98 @@ -import { Divider } from '../Divider'; -import { Flex, FlexItem } from '../../../layouts/Flex'; import * as React from 'react'; -import { render } from '@testing-library/react'; +import { render, screen } from '@testing-library/react'; +import { Divider } from '../Divider'; -test('divider using hr', () => { - const { asFragment } = render(); - expect(asFragment()).toMatchSnapshot(); +test('Renders with only the class pf-v5-c-divider by default', () => { + render(); + expect(screen.getByTestId('divider')).toHaveClass('pf-v5-c-divider', { exact: true }); }); -test('divider using li', () => { - const { asFragment } = render(); - expect(asFragment()).toMatchSnapshot(); +test('Renders with horizontal rule by default', () => { + render(); + expect(screen.getByRole('separator')).toContainHTML('
'); }); -test('divider using div', () => { - const { asFragment } = render(); - expect(asFragment()).toMatchSnapshot(); +test('Renders with vertical divider', () => { + render(); + expect(screen.getByRole('separator')).toHaveClass('pf-m-vertical'); +}); + +test('Renders with li', () => { + render(); + expect(screen.getByRole('separator')).toContainHTML('