From 5643a142d1d5c58c7d2febc57750f486a3e9dc3d Mon Sep 17 00:00:00 2001 From: Sanne Raymaekers Date: Mon, 28 Mar 2022 10:47:56 +0200 Subject: [PATCH] CreateImageWizard: Add customTitle to step template This is used by substeps. --- .../CreateImageWizard/steps/stepTemplate.js | 13 +++++++++---- .../CreateImageWizard/CreateImageWizard.test.js | 6 ++++++ 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/src/Components/CreateImageWizard/steps/stepTemplate.js b/src/Components/CreateImageWizard/steps/stepTemplate.js index f29f5514..d7412561 100644 --- a/src/Components/CreateImageWizard/steps/stepTemplate.js +++ b/src/Components/CreateImageWizard/steps/stepTemplate.js @@ -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 }) => (
{((showTitles && showTitle !== false) || showTitle) && - ( - {title} - )} + (customTitle ? ( + customTitle + ) : ( + + {title} + + ))} {formFields}
); @@ -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, diff --git a/src/test/Components/CreateImageWizard/CreateImageWizard.test.js b/src/test/Components/CreateImageWizard/CreateImageWizard.test.js index 57db385b..8632950e 100644 --- a/src/test/Components/CreateImageWizard/CreateImageWizard.test.js +++ b/src/test/Components/CreateImageWizard/CreateImageWizard.test.js @@ -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 () => {