CreateImageWizard: Add CentOS speedbump

When selecting a distribution during the Image Output step, only RHEL
distributions are shown initially. A button at the bottom of the list of
distributions can be clicked to expand the list and display all
distributions, which at the moment adds CentOS-8 and CentOS-9 to the
list.

Implemented by passing a PF4 SelectViewMoreObject as the LoadingVariant
prop to the <Select>.

This feature (and therefore the ability to build CentOS images) is only
available in beta.
This commit is contained in:
lucasgarfield 2022-06-27 16:15:26 +02:00 committed by Sanne Raymaekers
parent 11c337be78
commit f6a98d2dca
3 changed files with 85 additions and 3 deletions

View file

@ -242,7 +242,7 @@ describe('Step Image output', () => {
expect(next).toBeDisabled();
});
test('expected releases are present on beta', async () => {
test('expect only RHEL releases before expansion', async () => {
setUp();
const releaseMenu = screen.getByRole('button', {
@ -250,6 +250,32 @@ describe('Step Image output', () => {
});
userEvent.click(releaseMenu);
await screen.findByRole('option', {
name: 'Red Hat Enterprise Linux (RHEL) 8',
});
await screen.findByRole('option', {
name: 'Red Hat Enterprise Linux (RHEL) 9',
});
await screen.findByRole('button', {
name: 'Show options for further development of RHEL',
});
userEvent.click(releaseMenu);
});
test('expect all releases after expansion', async () => {
setUp();
const releaseMenu = screen.getByRole('button', {
name: /options menu/i,
});
userEvent.click(releaseMenu);
const showOptionsButton = screen.getByRole('button', {
name: 'Show options for further development of RHEL',
});
userEvent.click(showOptionsButton);
await screen.findByRole('option', {
name: 'Red Hat Enterprise Linux (RHEL) 8',
});
@ -263,6 +289,39 @@ describe('Step Image output', () => {
name: 'CentOS Stream 9',
});
expect(showOptionsButton).not.toBeInTheDocument();
userEvent.click(releaseMenu);
});
test('clear button resets to initial state (unexpanded)', async () => {
setUp();
const releaseMenu = screen.getByRole('button', {
name: /options menu/i,
});
userEvent.click(releaseMenu);
const showOptionsButton = screen.getByRole('button', {
name: 'Show options for further development of RHEL',
});
userEvent.click(showOptionsButton);
const clearAllButton = screen.getByRole('button', {
name: /clear all/i,
});
userEvent.click(clearAllButton);
await screen.findByRole('option', {
name: 'Red Hat Enterprise Linux (RHEL) 8',
});
await screen.findByRole('option', {
name: 'Red Hat Enterprise Linux (RHEL) 9',
});
await screen.findByRole('button', {
name: 'Show options for further development of RHEL',
});
userEvent.click(releaseMenu);
});
});
@ -1125,6 +1184,12 @@ describe('Step Review', () => {
name: /options menu/i,
});
userEvent.click(releaseMenu);
const showOptionsButton = screen.getByRole('button', {
name: 'Show options for further development of RHEL',
});
userEvent.click(showOptionsButton);
const centos = screen.getByRole('option', {
name: 'CentOS Stream 8',
});