Skip to content

Commit

Permalink
fix: display SUPPORT_URL only if the url is configured
Browse files Browse the repository at this point in the history
  • Loading branch information
dcoa committed Oct 18, 2024
1 parent a174abb commit b7dc47d
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .env.test
Original file line number Diff line number Diff line change
Expand Up @@ -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'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,11 @@ const getLearnerHeaderMenu = (
},
],
secondaryMenu: [
{
...(getConfig().SUPPORT_URL ? [{
type: 'item',
href: `${getConfig().SUPPORT_URL}`,
content: formatMessage(messages.help),
},
}] : []),
],
userMenu: [
{
Expand Down Expand Up @@ -70,6 +70,7 @@ const getLearnerHeaderMenu = (
],
},
],
});
}
);

export default getLearnerHeaderMenu;
Original file line number Diff line number Diff line change
Expand Up @@ -25,15 +25,7 @@ exports[`LearnerDashboardHeader render 1`] = `
},
]
}
secondaryMenuItems={
[
{
"content": "Help",
"href": "http://localhost:18000/support",
"type": "item",
},
]
}
secondaryMenuItems={[]}
userMenuItems={
[
{
Expand Down
7 changes: 7 additions & 0 deletions src/containers/LearnerDashboardHeader/index.test.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -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(<LearnerDashboardHeader />);
expect(wrapper.instance.findByType(Header)[0].props.secondaryMenuItems.length).toBe(1);
});
});

0 comments on commit b7dc47d

Please sign in to comment.