Don't use a default value in BooleanComponent (#3822)

This commit is contained in:
Erik Jan de Wit 2022-12-01 10:10:33 -05:00 committed by GitHub
parent c3b08cd601
commit 2f8980d09a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 4 deletions

View file

@ -142,32 +142,38 @@ describe("Realm settings events tab tests", () => {
cy.findByTestId("option-aes-generated").click(); cy.findByTestId("option-aes-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_aes-generated"); realmSettingsPage.enterConsoleDisplayName("test_aes-generated");
realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-ecdsa-generated").click(); cy.findByTestId("option-ecdsa-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_ecdsa-generated"); realmSettingsPage.enterConsoleDisplayName("test_ecdsa-generated");
realmSettingsPage.toggleSwitch("active", false); realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-hmac-generated").click(); cy.findByTestId("option-hmac-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_hmac-generated"); realmSettingsPage.enterConsoleDisplayName("test_hmac-generated");
realmSettingsPage.toggleSwitch("enabled", false); realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-rsa-generated").click(); cy.findByTestId("option-rsa-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_rsa-generated"); realmSettingsPage.enterConsoleDisplayName("test_rsa-generated");
realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown(); realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-rsa-enc-generated").click(); cy.findByTestId("option-rsa-enc-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_rsa-enc-generated"); realmSettingsPage.enterConsoleDisplayName("test_rsa-enc-generated");
realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider(); realmSettingsPage.addProvider();
}); });

View file

@ -10,7 +10,6 @@ export const BooleanComponent = ({
name, name,
label, label,
helpText, helpText,
defaultValue,
isDisabled = false, isDisabled = false,
}: ComponentProps) => { }: ComponentProps) => {
const { t } = useTranslation("dynamic"); const { t } = useTranslation("dynamic");
@ -28,7 +27,7 @@ export const BooleanComponent = ({
<Controller <Controller
name={convertToName(name!)} name={convertToName(name!)}
data-testid={name} data-testid={name}
defaultValue={defaultValue || false} defaultValue={false}
control={control} control={control}
render={({ onChange, value }) => ( render={({ onChange, value }) => (
<Switch <Switch