import { render, screen } from '@testing-library/react'; import { PanelFooter } from '../PanelFooter'; import styles from '@patternfly/react-styles/css/components/Panel/panel'; test('Renders without children', () => { render(
); expect(screen.getByTestId('panelFooter').firstChild).toBeVisible(); }); test('Renders children', () => { render(Test); expect(screen.getByText('Test')).toBeVisible(); }); test(`Renders with the class ${styles.panelFooter}`, () => { render(Test); expect(screen.getByText('Test')).toHaveClass(styles.panelFooter); }); test(`Renders with only the class ${styles.panelFooter} by default`, () => { render(Test); expect(screen.getByText('Test')).toHaveClass(styles.panelFooter, { exact: true }); }); test('Renders with custom class name when className prop is passed', () => { render(Test); expect(screen.getByText('Test')).toHaveClass('test-class'); }); test('Renders with the inherited element props spread to the component', () => { render(Test); expect(screen.getByText('Test')).toHaveAccessibleName('this is a simple panel footer'); }); test('Matches the snapshot', () => { const { asFragment } = render(Test); expect(asFragment()).toMatchSnapshot(); });