diff options
author | Anike Arni <aarni@thoughtworks.com> | 2017-03-29 10:49:34 -0300 |
---|---|---|
committer | Anike Arni <aarni@thoughtworks.com> | 2017-03-30 15:10:56 -0300 |
commit | 648aeebe1be3d29a6fdf3199a8d86d92de676b5a (patch) | |
tree | 2765d0bee19c66ece675e7cb1150edc163fda0ee /web-ui/src/common/header | |
parent | 8d49edac6af9dd08f1bb7b1727aee36af413a4a2 (diff) |
[#932] Hides logout button on account recovery flow
Diffstat (limited to 'web-ui/src/common/header')
-rw-r--r-- | web-ui/src/common/header/header.js | 12 | ||||
-rw-r--r-- | web-ui/src/common/header/header.spec.js | 13 |
2 files changed, 19 insertions, 6 deletions
diff --git a/web-ui/src/common/header/header.js b/web-ui/src/common/header/header.js index 715d54c6..3ad924c0 100644 --- a/web-ui/src/common/header/header.js +++ b/web-ui/src/common/header/header.js @@ -19,7 +19,7 @@ import React from 'react'; import Logout from 'src/common/logout/logout'; import './header.scss'; -export const Header = () => ( +export const Header = ({ renderLogout }) => ( <header className='header-wrapper'> <div className='header-content'> <a href='/'> @@ -30,10 +30,18 @@ export const Header = () => ( /> </a> <div className='header-icons'> - <Logout /> + { renderLogout ? <Logout /> : <div /> } </div> </div> </header> ); +Header.propTypes = { + renderLogout: React.PropTypes.bool +}; + +Header.defaultProps = { + renderLogout: false +}; + export default Header; diff --git a/web-ui/src/common/header/header.spec.js b/web-ui/src/common/header/header.spec.js index 81a952c7..0c11713b 100644 --- a/web-ui/src/common/header/header.spec.js +++ b/web-ui/src/common/header/header.spec.js @@ -11,11 +11,16 @@ describe('Header', () => { header = shallow(<Header />); }); - it('renders the header containing the logout button', () => { - expect(header.find('header').find(Logout)).toExist(); - }); - it('renders the header pixelated logo', () => { expect(header.find('header').find('img').props().alt).toEqual('Pixelated'); }); + + it('renders the header containing the logout button when renderLogout is true', () => { + header = shallow(<Header renderLogout />); + expect(header.find('header').find(Logout).length).toEqual(1); + }); + + it('hides logout button when renderLogout is false', () => { + expect(header.find('header').find(Logout).length).toEqual(0); + }); }); |