Skip to content
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 @@ -34,7 +34,7 @@ describe('PipelineStages', function () {
).to.exist;
});

it('renders button to add first stage', function () {
it('renders button to add first stage - when pipeline is empty', function () {
expect(within(container).getByTestId('pipeline-toolbar-add-stage-button'))
.to.exist;
});
Expand Down Expand Up @@ -66,11 +66,14 @@ describe('PipelineStages', function () {
container = screen.getByTestId('toolbar-pipeline-stages');
});
it('renders text to show no stages are in pipeline', function () {
expect(
within(container).findByText(
'Your pipeline is currently empty. To get started select the first stage.'
)
).to.exist;
expect(within(container).findByText('Your pipeline is currently empty.'))
.to.exist;
});

it('does not render button to add first stage - when pipeline is not empty', function () {
expect(() => {
within(container).getByTestId('pipeline-toolbar-add-stage-button');
}).to.throw;
});
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,16 +54,22 @@ export const PipelineStages: React.FunctionComponent<PipelineStagesProps> = ({
<div className={containerStyles} data-testid="toolbar-pipeline-stages">
{stages.filter(Boolean).length === 0 ? (
<Description className={cx(descriptionStyles)}>
Your pipeline is currently empty. To get started select the&nbsp;
<Link
className={addStageStyles}
as="button"
onClick={() => onStageAdded()}
hideExternalIcon
data-testid="pipeline-toolbar-add-stage-button"
>
first stage.
</Link>
Your pipeline is currently empty.
{stages.length === 0 && (
<>
{' '}
To get started select the&nbsp;
<Link
className={addStageStyles}
as="button"
onClick={() => onStageAdded()}
hideExternalIcon
data-testid="pipeline-toolbar-add-stage-button"
>
first stage.
</Link>
</>
)}
</Description>
) : (
<Pipeline size="small">
Expand Down