Use NumberInput
instead of input (#3961)
This commit is contained in:
parent
bd1e62a1ef
commit
a40deb7073
4 changed files with 81 additions and 39 deletions
|
@ -34,9 +34,12 @@ describe("SAML identity provider test", () => {
|
|||
describe("SAML identity provider creation", () => {
|
||||
const samlProviderName = "saml";
|
||||
|
||||
beforeEach(() => {
|
||||
before(() => {
|
||||
keycloakBefore();
|
||||
loginPage.logIn();
|
||||
});
|
||||
|
||||
beforeEach(() => {
|
||||
sidebarPage.goToIdentityProviders();
|
||||
});
|
||||
|
||||
|
|
|
@ -224,15 +224,15 @@ export default class ProviderSAMLSettings extends PageObject {
|
|||
|
||||
public assertTextFields() {
|
||||
cy.findByTestId(this.allowedClockSkew)
|
||||
.click()
|
||||
.type("not a number")
|
||||
.should("be.empty")
|
||||
.find("input")
|
||||
.should("have.value", 0)
|
||||
.clear()
|
||||
.type("111");
|
||||
|
||||
cy.findByTestId(this.attributeConsumingServiceIndex)
|
||||
.click()
|
||||
.type("not a number")
|
||||
.should("be.empty")
|
||||
.find("input")
|
||||
.should("have.value", 0)
|
||||
.clear()
|
||||
.type("111");
|
||||
|
||||
cy.findByTestId(this.attributeConsumingServiceName).click().type("name");
|
||||
|
|
|
@ -4,6 +4,7 @@ import { Controller, useFormContext, useWatch } from "react-hook-form";
|
|||
import {
|
||||
ExpandableSection,
|
||||
FormGroup,
|
||||
NumberInput,
|
||||
Select,
|
||||
SelectOption,
|
||||
SelectVariant,
|
||||
|
@ -472,15 +473,31 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
|
|||
fieldId="allowedClockSkew"
|
||||
helperTextInvalid={t("common:required")}
|
||||
>
|
||||
<KeycloakTextInput
|
||||
type="number"
|
||||
min="0"
|
||||
max="2147483"
|
||||
id="allowedClockSkew"
|
||||
data-testid="allowedClockSkew"
|
||||
<Controller
|
||||
name="config.allowedClockSkew"
|
||||
ref={register}
|
||||
isReadOnly={readOnly}
|
||||
defaultValue={0}
|
||||
control={control}
|
||||
render={({ onChange, value }) => {
|
||||
const v = Number(value);
|
||||
return (
|
||||
<NumberInput
|
||||
data-testid="allowedClockSkew"
|
||||
inputName="allowedClockSkew"
|
||||
min={0}
|
||||
max={2147483}
|
||||
value={v}
|
||||
readOnly
|
||||
onPlus={() => onChange(v + 1)}
|
||||
onMinus={() => onChange(v - 1)}
|
||||
onChange={(event) => {
|
||||
const value = Number(
|
||||
(event.target as HTMLInputElement).value
|
||||
);
|
||||
onChange(value < 0 ? 0 : value);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
|
@ -495,15 +512,31 @@ const Fields = ({ readOnly }: DescriptorSettingsProps) => {
|
|||
fieldId="attributeConsumingServiceIndex"
|
||||
helperTextInvalid={t("common:required")}
|
||||
>
|
||||
<KeycloakTextInput
|
||||
type="number"
|
||||
min="0"
|
||||
max="65535"
|
||||
id="attributeConsumingServiceIndex"
|
||||
data-testid="attributeConsumingServiceIndex"
|
||||
<Controller
|
||||
name="config.attributeConsumingServiceIndex"
|
||||
ref={register}
|
||||
isReadOnly={readOnly}
|
||||
defaultValue={0}
|
||||
control={control}
|
||||
render={({ onChange, value }) => {
|
||||
const v = Number(value);
|
||||
return (
|
||||
<NumberInput
|
||||
data-testid="attributeConsumingServiceIndex"
|
||||
inputName="attributeConsumingServiceIndex"
|
||||
min={0}
|
||||
max={2147483}
|
||||
value={v}
|
||||
readOnly
|
||||
onPlus={() => onChange(v + 1)}
|
||||
onMinus={() => onChange(v - 1)}
|
||||
onChange={(event) => {
|
||||
const value = Number(
|
||||
(event.target as HTMLInputElement).value
|
||||
);
|
||||
onChange(value < 0 ? 0 : value);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</FormGroup>
|
||||
|
||||
|
|
|
@ -91,23 +91,29 @@ export const ExtendedNonDiscoverySettings = () => {
|
|||
>
|
||||
<Controller
|
||||
name="config.allowedClockSkew"
|
||||
control={control}
|
||||
defaultValue={0}
|
||||
render={({ onChange, value }) => (
|
||||
<NumberInput
|
||||
value={value}
|
||||
data-testid="allowedClockSkew"
|
||||
onMinus={() => onChange(value - 1)}
|
||||
onChange={onChange}
|
||||
onPlus={() => onChange(value + 1)}
|
||||
inputName="input"
|
||||
inputAriaLabel={t("allowedClockSkew")}
|
||||
minusBtnAriaLabel={t("common:minus")}
|
||||
plusBtnAriaLabel={t("common:plus")}
|
||||
min={0}
|
||||
unit={t("common:times.seconds")}
|
||||
/>
|
||||
)}
|
||||
control={control}
|
||||
render={({ onChange, value }) => {
|
||||
const v = Number(value);
|
||||
return (
|
||||
<NumberInput
|
||||
data-testid="allowedClockSkew"
|
||||
inputName="allowedClockSkew"
|
||||
min={0}
|
||||
max={2147483}
|
||||
value={v}
|
||||
readOnly
|
||||
onPlus={() => onChange(v + 1)}
|
||||
onMinus={() => onChange(v - 1)}
|
||||
onChange={(event) => {
|
||||
const value = Number(
|
||||
(event.target as HTMLInputElement).value
|
||||
);
|
||||
onChange(value < 0 ? 0 : value);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
}}
|
||||
/>
|
||||
</FormGroup>
|
||||
<TextField field="config.forwardParameters" label="forwardParameters" />
|
||||
|
|
Loading…
Reference in a new issue