CreateImageWizard: conditionally render Registration tab
At the final review step, only render the Registration tab if the user has selected RHEL 8 as the release. Add a test to ensure that if the user selects CentOS as the release, there are only two tabs at the review step.
This commit is contained in:
parent
6d66ab3228
commit
3571c969ce
2 changed files with 55 additions and 37 deletions
|
|
@ -125,42 +125,43 @@ const ReviewStep = () => {
|
|||
}
|
||||
</List>
|
||||
</Tab>
|
||||
<Tab eventKey={ 1 } title={ <TabTitleText>Registration</TabTitleText> } data-testid='tab-registration'>
|
||||
{getState()?.values?.['register-system'] === 'register-later-radio-button' &&
|
||||
<TextContent>
|
||||
<TextList component={ TextListVariants.dl }>
|
||||
<TextListItem component={ TextListItemVariants.dt }>
|
||||
Subscription
|
||||
</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dd }>
|
||||
Register the system later
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
</TextContent>
|
||||
}
|
||||
{getState()?.values?.['register-system'] === 'subscribe-now-radio' &&
|
||||
getState()?.values?.release.includes('rhel') &&
|
||||
<TextContent>
|
||||
<TextList component={ TextListVariants.dl }>
|
||||
<TextListItem component={ TextListItemVariants.dt }>
|
||||
Subscription
|
||||
</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dd }>
|
||||
{getState()?.values?.['register-system'] === 'subscribe-now-radio' ?
|
||||
'Register the system on first boot' :
|
||||
registerValues?.[getState()?.values?.['register-system']?.title]
|
||||
}
|
||||
</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dt }>
|
||||
Activation key
|
||||
</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dd }>
|
||||
{getState()?.values?.['subscription-activation']}
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
</TextContent>
|
||||
}
|
||||
</Tab>
|
||||
{getState()?.values?.release.includes('rhel') &&
|
||||
<Tab eventKey={ 1 } title={ <TabTitleText>Registration</TabTitleText> } data-testid='tab-registration'>
|
||||
{getState()?.values?.['register-system'] === 'register-later-radio-button' &&
|
||||
<TextContent>
|
||||
<TextList component={ TextListVariants.dl }>
|
||||
<TextListItem component={ TextListItemVariants.dt }>
|
||||
Subscription
|
||||
</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dd }>
|
||||
Register the system later
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
</TextContent>
|
||||
}
|
||||
{getState()?.values?.['register-system'] === 'subscribe-now-radio' &&
|
||||
<TextContent>
|
||||
<TextList component={ TextListVariants.dl }>
|
||||
<TextListItem component={ TextListItemVariants.dt }>
|
||||
Subscription
|
||||
</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dd }>
|
||||
{getState()?.values?.['register-system'] === 'subscribe-now-radio' ?
|
||||
'Register the system on first boot' :
|
||||
registerValues?.[getState()?.values?.['register-system']?.title]
|
||||
}
|
||||
</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dt }>
|
||||
Activation key
|
||||
</TextListItem>
|
||||
<TextListItem component={ TextListItemVariants.dd }>
|
||||
{getState()?.values?.['subscription-activation']}
|
||||
</TextListItem>
|
||||
</TextList>
|
||||
</TextContent>
|
||||
}
|
||||
</Tab>
|
||||
}
|
||||
<Tab eventKey={ 2 } title={ <TabTitleText>System configuration</TabTitleText> } data-testid='tab-system'>
|
||||
<TextContent>
|
||||
<Text component={ TextVariants.h3 }>Packages</Text>
|
||||
|
|
|
|||
|
|
@ -750,7 +750,7 @@ describe('Step Review', () => {
|
|||
verifyCancelButton(cancel, history);
|
||||
});
|
||||
|
||||
test('has three tabs', async () => {
|
||||
test('has three tabs for rhel', async () => {
|
||||
setUp();
|
||||
|
||||
const buttonTarget = screen.getByTestId('tab-target');
|
||||
|
|
@ -768,6 +768,23 @@ describe('Step Review', () => {
|
|||
name: 'Packages'
|
||||
});
|
||||
});
|
||||
|
||||
test('has two tabs for centos', async () => {
|
||||
setUpCentOS();
|
||||
|
||||
const buttonTarget = screen.getByTestId('tab-target');
|
||||
const buttonSystem = screen.getByTestId('tab-system');
|
||||
expect(screen.queryByTestId('tab-registration')).not.toBeInTheDocument();
|
||||
|
||||
userEvent.click(buttonTarget);
|
||||
screen.getByRole('heading', {
|
||||
name: 'Amazon Web Services'
|
||||
});
|
||||
userEvent.click(buttonSystem);
|
||||
screen.getByRole('heading', {
|
||||
name: 'Packages'
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('Click through all steps', () => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue