Skip to content
Snippets Groups Projects
Commit 9bf96cf3 authored by Chris Beer's avatar Chris Beer
Browse files

Pass the any logout label through to the WindowAuthenticationBar

parent 4a7fd3e8
No related branches found
No related tags found
No related merge requests found
......@@ -79,9 +79,15 @@ describe('IIIFAuthentication', () => {
it('renders a logout button', () => {
const openWindow = jest.fn();
const resetAuthenticationState = jest.fn();
const wrapper = createWrapper({ openWindow, resetAuthenticationState, status: 'ok' });
const wrapper = createWrapper({
logoutConfirm: 'exit',
openWindow,
resetAuthenticationState,
status: 'ok',
});
expect(wrapper.find(WindowAuthenticationBar).length).toBe(1);
expect(wrapper.find(WindowAuthenticationBar).prop('confirmButton')).toEqual('logout');
expect(wrapper.find(WindowAuthenticationBar).prop('confirmButton')).toEqual('exit');
expect(wrapper.find(WindowAuthenticationBar).prop('hasLogoutService')).toEqual(true);
wrapper.find(WindowAuthenticationBar).simulate('confirm');
......
......@@ -53,14 +53,14 @@ export class IIIFAuthentication extends Component {
/** Render the auth bar for logged in users */
renderLoggedIn() {
const {
isInteractive, t,
isInteractive, logoutConfirm, t,
} = this.props;
if (!isInteractive) return null;
return (
<WindowAuthenticationBar
confirmButton={t('logout')}
confirmButton={logoutConfirm || t('logout')}
onConfirm={this.performLogout}
{...this.defaultAuthBarProps()}
/>
......@@ -164,6 +164,7 @@ IIIFAuthentication.propTypes = {
header: PropTypes.string,
isInteractive: PropTypes.bool,
label: PropTypes.string,
logoutConfirm: PropTypes.string,
logoutServiceId: PropTypes.string,
openWindow: PropTypes.func,
resetAuthenticationState: PropTypes.func.isRequired,
......@@ -183,6 +184,7 @@ IIIFAuthentication.defaultProps = {
header: undefined,
isInteractive: true,
label: undefined,
logoutConfirm: undefined,
logoutServiceId: undefined,
openWindow: window.open,
status: null,
......
......@@ -69,6 +69,9 @@ const mapStateToProps = (state, { windowId }) => {
header: service && service.getHeader(),
isInteractive,
label: service && service.getLabel()[0].value,
logoutConfirm: logoutService
&& logoutService.getLabel()[0]
&& logoutService.getLabel()[0].value,
logoutServiceId: logoutService && logoutService.id,
profile,
status,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment