-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add functionality to remove username from header
* Added a new environment variable that controls whether we want to remove username from header * Updated header component to hide username VAN-1805
- Loading branch information
1 parent
b70c6d2
commit 8136e74
Showing
9 changed files
with
357 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,3 +27,4 @@ USER_INFO_COOKIE_NAME=null | |
PUBLISHER_BASE_URL='' | ||
APP_ID='' | ||
MFE_CONFIG_API_URL='' | ||
HIDE_USERNAME_FROM_HEADER='' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import React from 'react'; | ||
import { IntlProvider } from '@edx/frontend-platform/i18n'; | ||
import { render } from '@testing-library/react'; | ||
import { Context as ResponsiveContext } from 'react-responsive'; | ||
import { AppContext } from '@edx/frontend-platform/react'; | ||
|
||
import Header from './Header'; | ||
|
||
describe('<Header />', () => { | ||
const appContextValue = { | ||
authenticatedUser: { | ||
userId: '123', | ||
username: 'abc', | ||
name: 'full name', | ||
}, | ||
config: { | ||
LMS_BASE_URL: process.env.LMS_BASE_URL, | ||
LOGO_URL: 'logo_url.jpg', | ||
}, | ||
}; | ||
|
||
it('renders correctly for authenticated desktop', () => { | ||
const component = ( | ||
<ResponsiveContext.Provider value={{ width: 1200 }}> | ||
<IntlProvider locale="en"> | ||
<AppContext.Provider value={appContextValue}> | ||
<Header /> | ||
</AppContext.Provider> | ||
</IntlProvider> | ||
</ResponsiveContext.Provider> | ||
); | ||
|
||
const { container: wrapper } = render(component); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
|
||
it('renders correctly for authenticated mobile', () => { | ||
const component = ( | ||
<ResponsiveContext.Provider value={{ width: 500 }}> | ||
<IntlProvider locale="en"> | ||
<AppContext.Provider value={appContextValue}> | ||
<Header /> | ||
</AppContext.Provider> | ||
</IntlProvider> | ||
</ResponsiveContext.Provider> | ||
); | ||
|
||
const { container: wrapper } = render(component); | ||
expect(wrapper).toMatchSnapshot(); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.