import * as React from 'react';
import { render, screen } from '@testing-library/react';
import { PanelMain } from '../PanelMain';
test('Renders without children', () => {
render(
);
expect(screen.getByTestId('panelMain').firstChild).toBeVisible();
});
test('Renders children', () => {
render(Test);
expect(screen.getByText('Test')).toBeVisible();
});
test('Renders with the class pf-v5-c-panel__main', () => {
render(Test);
expect(screen.getByText('Test')).toHaveClass('pf-v5-c-panel__main');
});
test('Renders with only the class pf-v5-c-panel__main by default', () => {
render(Test);
expect(screen.getByText('Test')).toHaveClass('pf-v5-c-panel__main', { 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 custom max height name when maxHeight prop is passed', () => {
render(Test);
const styles = getComputedStyle(screen.getByText('Test'));
expect(styles.getPropertyValue('--pf-v5-c-panel__main--MaxHeight')).toBe('100px');
});
test('Renders with the inherited element props spread to the component', () => {
render(Test);
expect(screen.getByText('Test')).toHaveAccessibleName('this is a simple panel main');
});
test('Matches the snapshot', () => {
const { asFragment } = render(Test);
expect(asFragment()).toMatchSnapshot();
});