register-user-profile.ftl tested working

This commit is contained in:
garronej
2021-10-12 02:09:09 +02:00
parent e3df4b83eb
commit 57932386bf
2 changed files with 7 additions and 15 deletions

View File

@ -68,6 +68,7 @@ export const RegisterUserProfile = memo(({ kcContext, ...props }: { kcContext: K
id="password-confirm" id="password-confirm"
className={cx(props.kcInputClass)} className={cx(props.kcInputClass)}
name="password-confirm" name="password-confirm"
autoComplete="new-password"
aria-invalid={messagesPerField.existsError("password-confirm")} aria-invalid={messagesPerField.existsError("password-confirm")}
/> />
{messagesPerField.existsError("password-confirm") && ( {messagesPerField.existsError("password-confirm") && (
@ -141,18 +142,11 @@ const UserProfileFormFields = memo(
return ( return (
<> <>
{kcContext.profile.attributes.map((attribute, i) => { {kcContext.profile.attributes
const { group = "", groupDisplayHeader = "", groupDisplayDescription = "" } = attribute; .map(attribute => [attribute, attribute])
.map(([attribute, { group = "", groupDisplayHeader = "", groupDisplayDescription = "" }], i) => (
console.log(JSON.stringify(attribute, null, 2));
//if (group === currentGroup) return null;
currentGroup = group;
return (
<Fragment key={i}> <Fragment key={i}>
{group !== "" && ( {group !== currentGroup && (currentGroup = group) !== "" && (
<div className={cx(props.kcFormGroupClass)}> <div className={cx(props.kcFormGroupClass)}>
<div className={cx(props.kcContentWrapperClass)}> <div className={cx(props.kcContentWrapperClass)}>
<label id={`header-${group}`} className={cx(props.kcFormGroupHeader)}> <label id={`header-${group}`} className={cx(props.kcFormGroupHeader)}>
@ -200,8 +194,7 @@ const UserProfileFormFields = memo(
</div> </div>
<AfterField attribute={attribute} /> <AfterField attribute={attribute} />
</Fragment> </Fragment>
); ))}
})}
</> </>
); );
}, },

View File

@ -21,7 +21,7 @@ export const kcContextCommonMock: KcContextBase.Common = {
"displayName": "myrealm", "displayName": "myrealm",
"displayNameHtml": "myrealm", "displayNameHtml": "myrealm",
"internationalizationEnabled": true, "internationalizationEnabled": true,
"registrationEmailAsUsername": true, "registrationEmailAsUsername": false,
}, },
"messagesPerField": { "messagesPerField": {
"printIfExists": (...[, x]) => x, "printIfExists": (...[, x]) => x,
@ -185,7 +185,6 @@ export const kcContextMocks: KcContextBase[] = [
id<KcContextBase.RegisterUserProfile>({ id<KcContextBase.RegisterUserProfile>({
"pageId": "register-user-profile.ftl", "pageId": "register-user-profile.ftl",
...registerCommon, ...registerCommon,
"profile": { "profile": {
"context": "REGISTRATION_PROFILE" as const, "context": "REGISTRATION_PROFILE" as const,
...(() => { ...(() => {