mirror of
https://github.com/discourse/discourse.git
synced 2025-05-22 17:41:17 +08:00
UX: don't show search and hamburger menus to anon visitors on login-required sites
This commit is contained in:
@ -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'));
|
||||
}
|
||||
});
|
||||
|
Reference in New Issue
Block a user