feat: keep username suggestion for embedded experience (#950)

* feat: keep username suggestion for embedded experience
This commit is contained in:
Zainab Amir
2023-06-21 10:30:26 +05:00
committed by GitHub
parent 9e13141f6b
commit a802821ae9
2 changed files with 12 additions and 3 deletions

View File

@@ -412,10 +412,19 @@ const RegistrationPage = (props) => {
};
const handleOnBlur = (event) => {
const { name, value } = event.target;
if (registrationEmbedded) {
if (name === 'name') {
validateInput(
name,
value,
{ name: formFields.name, username: formFields.username, form_field_key: name },
!validationApiRateLimited,
false,
);
}
return;
}
const { name, value } = event.target;
const payload = {
name: formFields.name,
email: formFields.email,

View File

@@ -252,7 +252,7 @@ describe('RegistrationPage', () => {
it('should not run validations on blur event when embedded variant is rendered', () => {
delete window.location;
window.location = { href: getConfig().BASE_URL.concat(REGISTER_PAGE), search: '?variant=embedded&host=http://localhost/host-website' };
window.location = { href: getConfig().BASE_URL.concat(REGISTER_PAGE), search: '?host=http://localhost/host-website' };
const registrationPage = mount(reduxWrapper(<IntlRegistrationPage {...props} />));
registrationPage.find('input#username').simulate('blur', { target: { value: '', name: 'username' } });
@@ -883,7 +883,7 @@ describe('RegistrationPage', () => {
window.parent.postMessage = jest.fn();
delete window.location;
window.location = { href: getConfig().BASE_URL.concat(AUTHN_PROGRESSIVE_PROFILING), search: '?variant=embedded&host=http://localhost/host-website' };
window.location = { href: getConfig().BASE_URL.concat(AUTHN_PROGRESSIVE_PROFILING), search: '?host=http://localhost/host-website' };
store = mockStore({
...initialState,