import { render, screen } from '@testing-library/react'; import styles from '@patternfly/react-styles/css/components/Table/table'; import { Td } from '../Td'; test('Renders without children', () => { render(
); expect(screen.getByRole('cell')).toBeInTheDocument(); }); test('Renders with children', () => { render(
Cell content
); expect(screen.getByRole('cell')).toHaveTextContent('Cell content'); }); test(`Applies ${styles.modifiers.action} when hasAction is true`, () => { render(
Cell with action
); expect(screen.getByRole('cell')).toHaveClass('pf-m-action'); }); test(`Does not apply ${styles.modifiers.action} when hasAction is false`, () => { render(
Cell without action
); expect(screen.getByRole('cell')).not.toHaveClass('pf-m-action'); }); test('Matches snapshot without children', () => { const { asFragment } = render(
); expect(asFragment()).toMatchSnapshot(); }); test('Matches snapshot with children', () => { const { asFragment } = render(
Cell content
); expect(asFragment()).toMatchSnapshot(); });