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