import { screen, render } from '@testing-library/react'; import { ClipboardCopyAction } from '../ClipboardCopyAction'; import styles from '@patternfly/react-styles/css/components/ClipboardCopy/clipboard-copy'; test('Renders without children', () => { render(
); expect(screen.getByTestId('container').firstChild).toBeVisible(); }); test(`Renders with class ${styles.clipboardCopyActionsItem} by default`, () => { render(Action text); expect(screen.getByText('Action text')).toHaveClass(styles.clipboardCopyActionsItem, { exact: true }); }); test(`Renders with custom class when className is passed`, () => { render(Action text); expect(screen.getByText('Action text')).toHaveClass('custom-class'); }); test(`Spreads additional props`, () => { render(Action text); expect(screen.getByText('Action text')).toHaveAttribute('id', 'test-id'); }); test('Matches snapshot', () => { const { asFragment } = render(Action text); expect(asFragment()).toMatchSnapshot(); });