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();
realmSettingsPage.enterConsoleDisplayName("test_aes-generated");
realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-ecdsa-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_ecdsa-generated");
realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-hmac-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_hmac-generated");
realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-rsa-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_rsa-generated");
realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider();
realmSettingsPage.toggleAddProviderDropdown();
cy.findByTestId("option-rsa-enc-generated").click();
realmSettingsPage.enterConsoleDisplayName("test_rsa-enc-generated");
realmSettingsPage.toggleSwitch("active", false);
realmSettingsPage.toggleSwitch("enabled", false);
realmSettingsPage.addProvider();
});

View file

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