From b4d4e36f723a5d1c621bc487f42bc44de6ed0605 Mon Sep 17 00:00:00 2001 From: Dmytro <98233552+DmytroAlipov@users.noreply.github.com> Date: Thu, 9 Mar 2023 06:31:40 +0200 Subject: [PATCH] feat: displaying a support link on the welcome page (#762) This update adds a display dependency support links on welcome page if variable AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK non-empty in MFE settings. --- .../ProgressiveProfiling.jsx | 26 ++++++++++--------- .../tests/ProgressiveProfiling.test.jsx | 18 +++++++++++++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/progressive-profiling/ProgressiveProfiling.jsx b/src/progressive-profiling/ProgressiveProfiling.jsx index f8381d48..093d2803 100644 --- a/src/progressive-profiling/ProgressiveProfiling.jsx +++ b/src/progressive-profiling/ProgressiveProfiling.jsx @@ -180,18 +180,20 @@ const ProgressiveProfiling = (props) => { ) : null}
{formFields} - - (sendTrackEvent('edx.bi.welcome.page.support.link.clicked'))} - > - {intl.formatMessage(messages['optional.fields.information.link'])} - - + {(getConfig().AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK) && ( + + (sendTrackEvent('edx.bi.welcome.page.support.link.clicked'))} + > + {intl.formatMessage(messages['optional.fields.information.link'])} + + + )}
{ }; }); + it('not should display button "Learn more about how we use this information."', async () => { + mergeConfig({ + AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK: '', + }); + const progressiveProfilingPage = await getProgressiveProfilingPage(); + + expect(progressiveProfilingPage.find('a.pgn__hyperlink').exists()).toBeFalsy(); + }); + + it('should display button "Learn more about how we use this information."', async () => { + mergeConfig({ + AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK: 'http://localhost:1999/support', + }); + const progressiveProfilingPage = await getProgressiveProfilingPage(); + + expect(progressiveProfilingPage.find('a.pgn__hyperlink').text()).toEqual('Learn more about how we use this information.'); + }); + it('should render fields returned by backend api', async () => { const progressiveProfilingPage = await getProgressiveProfilingPage(); expect(progressiveProfilingPage.find('#gender').exists()).toBeTruthy();