UX: don't show search and hamburger menus to anon visitors on login-required sites

This commit is contained in:
Neil Lalonde
2017-01-16 16:33:14 -05:00
parent fbf9172db8
commit 60a9030d25
3 changed files with 40 additions and 15 deletions

View File

@ -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'));
}
});