import * as React from 'react'; import { render, screen } from '@testing-library/react'; import { TextContent } from '../TextContent'; test('Renders without children', () => { render(
); expect(screen.getByTestId('test-content').firstChild).toBeVisible(); }); test('Renders children', () => { render(Test); expect(screen.getByText('Test')).toBeVisible(); }); test('Renders with class name pf-v5-c-content', () => { render(Test); expect(screen.getByText('Test')).toHaveClass('pf-v5-c-content', { exact: true }); }); test('Renders with custom class name when className prop is provided', () => { render(Test); expect(screen.getByText('Test')).toHaveClass('custom-class'); }); test('Renders without class name pf-m-visited by default', () => { render(Test); expect(screen.getByText('Test')).not.toHaveClass('pf-m-visited'); }); test('Renders with class name pf-m-visited when isVisited=true', () => { render(Test); expect(screen.getByText('Test')).toHaveClass('pf-m-visited'); }); test('Renders with inherited element props spread to the component', () => { render(Test); expect(screen.getByText('Test')).toHaveAccessibleName('Test label'); }); test('Matches the snapshot', () => { const { asFragment } = render(Test); expect(asFragment()).toMatchSnapshot(); });