CreateImageWizard: target env validation

Validation is not enforced on the image output step
when selecting and then deselecting an image type. This
is because the only validation which is set is `Required`.
However, after deselecting an image type the input becomes
a key-value object with all the values set to false. This
commit adds a custom validator to check that at least one
value in the object is set to true. Fixes #575
This commit is contained in:
Gianluca Zuccarelli 2022-03-24 15:43:21 +00:00 committed by jkozol
parent 787e1ba5ce
commit 78123bff0e
5 changed files with 40 additions and 1 deletions

View file

@ -221,6 +221,26 @@ describe('Step Image output', () => {
expect(destination).toBeEnabled();
expect(destination).toContainElement(required);
});
test('selecting and deselecting a tile disables the next button', () => {
setUp();
const [ next, , ] = verifyButtons();
const awsTile = screen.getByTestId('upload-aws');
// this has already been clicked once in the setup function
awsTile.click(); // deselect
const googleTile = screen.getByTestId('upload-google');
googleTile.click(); // select
googleTile.click(); // deselect
const azureTile = screen.getByTestId('upload-azure');
azureTile.click(); // select
azureTile.click(); // deselect
expect(next).toBeDisabled();
});
});
describe('Step Upload to AWS', () => {