UX: don't show search and hamburger menus to anon visitors on login-required sites
This commit is contained in:
parent
fbf9172db8
commit
60a9030d25
|
@ -104,6 +104,8 @@ createWidget('header-icons', {
|
|||
},
|
||||
|
||||
html(attrs) {
|
||||
if (this.siteSettings.login_required && !this.currentUser) { return []; }
|
||||
|
||||
const hamburger = this.attach('header-dropdown', {
|
||||
title: 'hamburger_menu',
|
||||
icon: 'bars',
|
||||
|
|
|
@ -26,19 +26,4 @@ test("redirect", () => {
|
|||
andThen(() => {
|
||||
ok(invisible('.login-modal'), "it closes the login modal");
|
||||
});
|
||||
|
||||
click('#search-button');
|
||||
andThen(() => {
|
||||
ok(exists('.login-modal'), "clicking search opens the login modal");
|
||||
});
|
||||
|
||||
click('.modal-header .close');
|
||||
andThen(() => {
|
||||
ok(invisible('.login-modal'), "it closes the login modal");
|
||||
});
|
||||
|
||||
click('#toggle-hamburger-menu');
|
||||
andThen(() => {
|
||||
ok(exists('.login-modal'), "site map opens the login modal");
|
||||
});
|
||||
});
|
||||
|
|
|
@ -35,3 +35,41 @@ widgetTest('sign up / login buttons', {
|
|||
});
|
||||
}
|
||||
});
|
||||
|
||||
widgetTest('anon when login required', {
|
||||
template: '{{mount-widget widget="header" showCreateAccount="showCreateAccount" showLogin="showLogin" args=args}}',
|
||||
anonymous: true,
|
||||
|
||||
setup() {
|
||||
this.set('args', { canSignUp: true });
|
||||
this.on('showCreateAccount', () => this.signupShown = true);
|
||||
this.on('showLogin', () => this.loginShown = true);
|
||||
this.siteSettings.login_required = true;
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(exists('button.login-button'));
|
||||
assert.ok(exists('button.sign-up-button'));
|
||||
assert.ok(!exists('#search-button'));
|
||||
assert.ok(!exists('#toggle-hamburger-menu'));
|
||||
}
|
||||
});
|
||||
|
||||
widgetTest('logged in when login required', {
|
||||
template: '{{mount-widget widget="header" showCreateAccount="showCreateAccount" showLogin="showLogin" args=args}}',
|
||||
|
||||
setup() {
|
||||
this.set('args', { canSignUp: true });
|
||||
this.on('showCreateAccount', () => this.signupShown = true);
|
||||
this.on('showLogin', () => this.loginShown = true);
|
||||
this.siteSettings.login_required = true;
|
||||
},
|
||||
|
||||
test(assert) {
|
||||
assert.ok(!exists('button.login-button'));
|
||||
assert.ok(!exists('button.sign-up-button'));
|
||||
assert.ok(exists('#search-button'));
|
||||
assert.ok(exists('#toggle-hamburger-menu'));
|
||||
assert.ok(exists('#current-user'));
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Reference in New Issue