From ed4fbaaca51f9d17a424482ab0bce76102c5c48e Mon Sep 17 00:00:00 2001 From: Dmytro <98233552+DmytroAlipov@users.noreply.github.com> Date: Wed, 8 Mar 2023 07:08:59 +0200 Subject: [PATCH] feat: displaying a support link on the welcome page (#763) This update adds a display dependency support links on welcome page if variable AUTHN_PROGRESSIVE_PROFILING_SUPPORT_LINK non-empty in MFE configuration. --- src/welcome/ProgressiveProfiling.jsx | 26 ++++++++++--------- .../tests/ProgressiveProfiling.test.jsx | 18 +++++++++++++ 2 files changed, 32 insertions(+), 12 deletions(-) diff --git a/src/welcome/ProgressiveProfiling.jsx b/src/welcome/ProgressiveProfiling.jsx index 16aa8247..e307980c 100644 --- a/src/welcome/ProgressiveProfiling.jsx +++ b/src/welcome/ProgressiveProfiling.jsx @@ -148,18 +148,20 @@ const ProgressiveProfiling = (props) => { ) : null}
{formFields} - - (sendTrackEvent('edx.bi.welcome.page.support.link.clicked'))} - > - {intl.formatMessage(messages['optional.fields.information.link'])} - - + {(getConfig().WELCOME_PAGE_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({ + WELCOME_PAGE_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({ + WELCOME_PAGE_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();