CreateImageWizard: Add customTitle to step template

This is used by substeps.
This commit is contained in:
Sanne Raymaekers 2022-03-28 10:47:56 +02:00
parent e99b7b7d0b
commit 5643a142d1
2 changed files with 15 additions and 4 deletions

View file

@ -2,12 +2,16 @@ import React from 'react';
import PropTypes from 'prop-types';
import { Title } from '@patternfly/react-core';
const StepTemplate = ({ id, formFields, formRef, title, showTitle, showTitles }) => (
const StepTemplate = ({ id, formFields, formRef, title, customTitle, showTitle, showTitles }) => (
<div id={ id } ref={ formRef } className="pf-c-form">
{((showTitles && showTitle !== false) || showTitle) &&
(<Title headingLevel="h1" size="xl">
{title}
</Title>)}
(customTitle ? (
customTitle
) : (
<Title headingLevel="h1" size="xl">
{title}
</Title>
))}
{formFields}
</div>
);
@ -15,6 +19,7 @@ const StepTemplate = ({ id, formFields, formRef, title, showTitle, showTitles })
StepTemplate.propTypes = {
id: PropTypes.string,
title: PropTypes.node,
customTitle: PropTypes.node,
formFields: PropTypes.array.isRequired,
formOptions: PropTypes.shape({
renderForm: PropTypes.func.isRequired,

View file

@ -235,6 +235,8 @@ describe('Step Upload to AWS', () => {
awsTile.click();
next.click();
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Target environment - Amazon Web Service');
};
test('clicking Next loads Registration', async () => {
@ -289,6 +291,8 @@ describe('Step Upload to Google', () => {
awsTile.click();
next.click();
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Target environment - Google Cloud Platform');
};
test('clicking Next loads Registration', async () => {
@ -354,6 +358,8 @@ describe('Step Upload to Azure', () => {
const awsTile = screen.getByTestId('upload-azure');
awsTile.click();
next.click();
expect(screen.getByRole('heading', { level: 1 })).toHaveTextContent('Target environment - Microsoft Azure');
};
test('clicking Next loads Registration', async () => {