import * as React from 'react';
import { render, screen } from '@testing-library/react';
import { ProgressStepper } from '../ProgressStepper';
import { ProgressStep } from '../ProgressStep';
import InProgressIcon from '@patternfly/react-icons/dist/esm/icons/in-progress-icon';
describe('ProgressStepper', () => {
test('renders content', () => {
const { asFragment } = render(
First
Second
Third
);
expect(asFragment()).toMatchSnapshot();
});
test('gets custom class and id', () => {
const { asFragment } = render(
First
Second
Third
);
expect(asFragment()).toMatchSnapshot();
});
test('renders vertically', () => {
const { asFragment } = render(
First
Second
Third
);
expect(asFragment()).toMatchSnapshot();
});
test('renders compact', () => {
const { asFragment } = render(
First
Second
Third
);
expect(asFragment()).toMatchSnapshot();
});
test('renders center aligned', () => {
const { asFragment } = render(
First
Second
Third
);
expect(asFragment()).toMatchSnapshot();
});
});
describe('ProgressStep', () => {
test('renders content', () => {
const { asFragment } = render(Title);
expect(asFragment()).toMatchSnapshot();
});
Object.values(['default', 'success', 'info', 'pending', 'warning', 'danger']).forEach(variant => {
test(`renders ${variant} variant`, () => {
const { asFragment } = render(
{variant} step
);
expect(asFragment()).toMatchSnapshot();
});
});
test('renders current', () => {
const { asFragment } = render(Title);
expect(asFragment()).toMatchSnapshot();
});
test('renders help text styling', () => {
const { asFragment } = render( }>Title);
expect(asFragment()).toMatchSnapshot();
});
test('renders custom icon', () => {
const { asFragment } = render(}>Title);
expect(asFragment()).toMatchSnapshot();
});
test('renders custom null icon - removing default from variant', () => {
const { asFragment } = render(
Title
);
expect(asFragment()).toMatchSnapshot();
});
test('renders description', () => {
const { asFragment } = render(Title);
expect(asFragment()).toMatchSnapshot();
});
});
test('renders description class and text', () => {
render(
Title
);
expect(screen.getByText('Test description')).toBeVisible();
expect(screen.getByText('Test description')).toHaveClass('pf-c-progress-stepper__step-description');
});
test('renders description line break', () => {
render(
Testing description
Line break
>
}
>
Title
);
expect(screen.getByText("Testing descriptionLine break")).toBeVisible();
});