diff --git a/.env.development b/.env.development index 86014958..55cfa710 100644 --- a/.env.development +++ b/.env.development @@ -20,7 +20,7 @@ LMS_CLIENT_ID='login-service-client-id' SEGMENT_KEY='' FEATURE_FLAGS={} MARKETING_SITE_BASE_URL='http://localhost:18000' -SUPPORT_URL='http://localhost:18000/support' +SUPPORT_URL='' CONTACT_URL='http://localhost:18000/contact' OPEN_SOURCE_URL='http://localhost:18000/openedx' TERMS_OF_SERVICE_URL='http://localhost:18000/terms-of-service' diff --git a/.env.test b/.env.test index 705a9889..e66d42c8 100644 --- a/.env.test +++ b/.env.test @@ -20,7 +20,7 @@ LMS_CLIENT_ID='login-service-client-id' SEGMENT_KEY='' FEATURE_FLAGS={} MARKETING_SITE_BASE_URL='http://localhost:18000' -SUPPORT_URL='http://localhost:18000/support' +SUPPORT_URL='' CONTACT_URL='http://localhost:18000/contact' OPEN_SOURCE_URL='http://localhost:18000/openedx' TERMS_OF_SERVICE_URL='http://localhost:18000/terms-of-service' diff --git a/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx b/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx index 9dcecc3a..092bcfe7 100644 --- a/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx +++ b/src/containers/LearnerDashboardHeader/LearnerDashboardMenu.jsx @@ -32,11 +32,11 @@ const getLearnerHeaderMenu = ( }, ], secondaryMenu: [ - { + ...(getConfig().SUPPORT_URL ? [{ type: 'item', href: `${getConfig().SUPPORT_URL}`, content: formatMessage(messages.help), - }, + }] : []), ], userMenu: [ { @@ -70,6 +70,7 @@ const getLearnerHeaderMenu = ( ], }, ], -}); +} +); export default getLearnerHeaderMenu; diff --git a/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap b/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap index a1f0a9e7..80d09001 100644 --- a/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap +++ b/src/containers/LearnerDashboardHeader/__snapshots__/index.test.jsx.snap @@ -25,15 +25,7 @@ exports[`LearnerDashboardHeader render 1`] = ` }, ] } - secondaryMenuItems={ - [ - { - "content": "Help", - "href": "http://localhost:18000/support", - "type": "item", - }, - ] - } + secondaryMenuItems={[]} userMenuItems={ [ { diff --git a/src/containers/LearnerDashboardHeader/index.test.jsx b/src/containers/LearnerDashboardHeader/index.test.jsx index e07fbda4..4e552925 100644 --- a/src/containers/LearnerDashboardHeader/index.test.jsx +++ b/src/containers/LearnerDashboardHeader/index.test.jsx @@ -31,5 +31,12 @@ describe('LearnerDashboardHeader', () => { expect(wrapper.instance.findByType(Header)).toHaveLength(1); wrapper.instance.findByType(Header)[0].props.mainMenuItems[2].onClick(); expect(findCoursesNavClicked).toHaveBeenCalledWith(urls.baseAppUrl('/course-search-url')); + expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(0); + }); + + test('should display Help link if SUPPORT_URL is set', () => { + mergeConfig({ SUPPORT_URL: 'http://localhost:18000/support' }); + const wrapper = shallow(); + expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(1); }); });