import React from 'react'; import { render, screen } from '@testing-library/react'; import '@testing-library/jest-dom'; import { TextInputGroup, TextInputGroupContext } from '../TextInputGroup'; describe('TextInputGroup', () => { it('renders without children', () => { render(); expect(screen.getByTestId('TextInputGroup')).toBeVisible(); }); it('renders children', () => { render(Test); expect(screen.getByText('Test')).toBeVisible(); }); it('renders with class pf-v5-c-text-input-group', () => { render(Test); const inputGroup = screen.getByText('Test'); expect(inputGroup).toHaveClass('pf-v5-c-text-input-group'); }); it('renders with custom class names provided via prop', () => { render(Test); const inputGroup = screen.getByText('Test'); expect(inputGroup).toHaveClass('custom-class'); }); it('does not render with the pf-m-disabled class when not disabled', () => { render(Test); const inputGroup = screen.getByText('Test'); expect(inputGroup).not.toHaveClass('pf-m-disabled'); }); it('renders with the pf-m-disabled class when disabled', () => { render(Test); const inputGroup = screen.getByText('Test'); expect(inputGroup).toHaveClass('pf-m-disabled'); }); it('passes isDisabled=false to children via a context when isDisabled prop is not passed', () => { const TestComponent: React.FunctionComponent = () => { const context = React.useContext(TextInputGroupContext); return