import * as React from 'react';
import { render, screen } from '@testing-library/react';
import { Hint } from '../Hint';
test('renders without children', () => {
render();
expect(screen.getByTestId('Hint')).toBeVisible();
});
test('renders children', () => {
render(Test);
expect(screen.getByText('Test')).toBeVisible();
});
test('renders with class pf-v5-c-hint', () => {
render(Test);
const hint = screen.getByText('Test');
expect(hint).toHaveClass('pf-v5-c-hint');
});
test('renders with custom class names provided via prop', () => {
render(Test);
const hint = screen.getByText('Test');
expect(hint).toHaveClass('custom-classname');
});
test('does not render actions options when not passed', () => {
render(Test);
const actions = screen.queryByText('actions');
expect(actions).not.toBeInTheDocument();
});
test('renders actions options', () => {
render(Test);
const actions = screen.getByText('actions');
expect(actions).toBeVisible();
});
test('renders with class pf-v5-c-hint__actions if there is an action prop', () => {
render(Test);
const hint = screen.getByText('actions');
expect(hint).toHaveClass('pf-v5-c-hint__actions');
});
test('renders with inherited element props spread to the component', () => {
render(Test);
expect(screen.getByText('Test')).toHaveAccessibleName('labelling-id');
});
test('matches hint snapshot', () => {
const { asFragment } = render();
expect(asFragment()).toMatchSnapshot();
});