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(
);
expect(screen.getByRole('cell')).toHaveTextContent('Cell content');
});
test(`Applies ${styles.modifiers.action} when hasAction is true`, () => {
render(
);
expect(screen.getByRole('cell')).toHaveClass('pf-m-action');
});
test(`Does not apply ${styles.modifiers.action} when hasAction is false`, () => {
render(
);
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(
);
expect(asFragment()).toMatchSnapshot();
});