Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(ProgressStepper): updating description prop to ReactNode #8017

Merged
merged 2 commits into from
Sep 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ export interface ProgressStepProps
/** Custom icon of a progress step. Will override default icons provided by the variant. */
icon?: React.ReactNode;
/** Description text of a progress step. */
description?: string;
description?: React.ReactNode;
/** ID of the title of the progress step. */
titleId?: string;
/** Accessible label for the progress step. Should communicate all information being communicated by the progress
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { render } from '@testing-library/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';
Expand Down Expand Up @@ -110,3 +110,34 @@ describe('ProgressStep', () => {
expect(asFragment()).toMatchSnapshot();
});
});

test('renders description class and text', () => {
render(
<ProgressStep
description="Test description"
>
Title
</ProgressStep>
);

expect(screen.getByText('Test description')).toBeVisible();
expect(screen.getByText('Test description')).toHaveClass('pf-c-progress-stepper__step-description');
});

test('renders description line break', () => {
render(
<ProgressStep
description={
<>
Testing description
<br />
Line break
</>
}
>
Title
</ProgressStep>
);

expect(screen.getByText("Testing descriptionLine break")).toBeVisible();
});