From a802821ae97170421a3bb3fbdc01ded867a053ea Mon Sep 17 00:00:00 2001 From: Zainab Amir Date: Wed, 21 Jun 2023 10:30:26 +0500 Subject: [PATCH] feat: keep username suggestion for embedded experience (#950) * feat: keep username suggestion for embedded experience --- src/register/RegistrationPage.jsx | 11 ++++++++++- src/register/tests/RegistrationPage.test.jsx | 4 ++-- 2 files changed, 12 insertions(+), 3 deletions(-) diff --git a/src/register/RegistrationPage.jsx b/src/register/RegistrationPage.jsx index 221d5ec5..8e78b3ba 100644 --- a/src/register/RegistrationPage.jsx +++ b/src/register/RegistrationPage.jsx @@ -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, diff --git a/src/register/tests/RegistrationPage.test.jsx b/src/register/tests/RegistrationPage.test.jsx index 3dc9b7b8..b50c730a 100644 --- a/src/register/tests/RegistrationPage.test.jsx +++ b/src/register/tests/RegistrationPage.test.jsx @@ -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()); 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,