diff --git a/web/src/components/core/Fieldset.jsx b/web/src/components/core/Fieldset.jsx index 2b5c978032..0af8bbd8fd 100644 --- a/web/src/components/core/Fieldset.jsx +++ b/web/src/components/core/Fieldset.jsx @@ -38,27 +38,14 @@ import "./fieldset.scss"; * * * - * @example Using a complex legend and isDisabled prop - *
- * } - * isDisabled={!encryptionAllowed} - * > - * - * - *
- * * @param {object} props * @param {React.ReactNode} props.legend - The lengend - * @param {boolean} [props.isDisabled=false] - whether the descendant form controls, except any inside legend, are disable * @param {string} [props.className] - additionally CSS class names * @param {JSX.Element} [props.children] - the section content * @param {object} [props.otherProps] fieldset element attributes, see {@link https://html.spec.whatwg.org/#the-fieldset-element} */ export default function Fieldset({ legend, - isDisabled, className, children, ...otherProps @@ -66,7 +53,6 @@ export default function Fieldset({ return (
{legend && {legend}} diff --git a/web/src/components/core/Fieldset.test.jsx b/web/src/components/core/Fieldset.test.jsx index 924d8c48cb..35a1a5ce10 100644 --- a/web/src/components/core/Fieldset.test.jsx +++ b/web/src/components/core/Fieldset.test.jsx @@ -51,25 +51,4 @@ describe("Fieldset", () => { const checkbox = within(fieldset).getByRole("checkbox"); expect(checkbox).toBeInTheDocument(); }); - - it("sets children (except legend) as disabled when isDisabled prop is given", () => { - installerRender( -
} isDisabled> - - - - -
- ); - - const fieldset = screen.getByRole("group", { name: /Using a checkbox/i }); - const legendCheckbox = within(fieldset).getByRole("checkbox", { name: "Using a checkbox in the legend" }); - const inputText = within(fieldset).getByRole("textbox", { name: "Username" }); - const checkbox = within(fieldset).getByRole("checkbox", { name: "Superuser" }); - - expect(fieldset).toHaveAttribute("disabled"); - expect(legendCheckbox).not.toBeDisabled(); - expect(inputText).toBeDisabled(); - expect(checkbox).toBeDisabled(); - }); }); diff --git a/web/src/components/core/PasswordAndConfirmationInput.jsx b/web/src/components/core/PasswordAndConfirmationInput.jsx index 608311c78c..211919d7b6 100644 --- a/web/src/components/core/PasswordAndConfirmationInput.jsx +++ b/web/src/components/core/PasswordAndConfirmationInput.jsx @@ -25,7 +25,7 @@ import { TextInput } from "@patternfly/react-core"; -const PasswordAndConfirmationInput = ({ value, onChange, onValidation }) => { +const PasswordAndConfirmationInput = ({ value, onChange, onValidation, isDisabled }) => { const [confirmation, setConfirmation] = useState(value || ""); const [error, setError] = useState(""); @@ -61,6 +61,7 @@ const PasswordAndConfirmationInput = ({ value, onChange, onValidation }) => { type="password" aria-label="User password" value={value} + isDisabled={isDisabled} onChange={onChangeValue} onBlur={() => validate(value, confirmation)} /> @@ -77,6 +78,7 @@ const PasswordAndConfirmationInput = ({ value, onChange, onValidation }) => { type="password" aria-label="User password confirmation" value={confirmation} + isDisabled={isDisabled} onChange={onChangeConfirmation} onBlur={() => validate(value, confirmation)} validated={error === "" ? "default" : "error"} diff --git a/web/src/components/core/PasswordAndConfirmationInput.test.jsx b/web/src/components/core/PasswordAndConfirmationInput.test.jsx index 9fa0588a22..ffa1a36cd1 100644 --- a/web/src/components/core/PasswordAndConfirmationInput.test.jsx +++ b/web/src/components/core/PasswordAndConfirmationInput.test.jsx @@ -38,8 +38,8 @@ describe("when the passwords do not match", () => { }); it("uses the given password value for confirmation too", async () => { - const { user } = plainRender( - + plainRender( + ); const passwordInput = screen.getByLabelText("Password"); @@ -48,3 +48,15 @@ it("uses the given password value for confirmation too", async () => { expect(passwordInput.value).toEqual("12345"); expect(passwordInput.value).toEqual(confirmationInput.value); }); + +it("disables both, password and confirmation, when isDisabled prop is given", async () => { + plainRender( + + ); + + const passwordInput = screen.getByLabelText("Password"); + const confirmationInput = screen.getByLabelText("Password confirmation"); + + expect(passwordInput).toBeDisabled(); + expect(confirmationInput).toBeDisabled(); +}); diff --git a/web/src/components/storage/ProposalSettingsForm.jsx b/web/src/components/storage/ProposalSettingsForm.jsx index cc3290c2c6..0723021890 100644 --- a/web/src/components/storage/ProposalSettingsForm.jsx +++ b/web/src/components/storage/ProposalSettingsForm.jsx @@ -91,7 +91,6 @@ export default function ProposalSettingsForm({ id, proposal, onSubmit, onValidat onChange={onLvmChange} />