Commit 67df786d authored by Jacob Schatz's avatar Jacob Schatz Committed by Rémy Coutable

Merge branch 'register-tab' into 'master'

Only show register tab if signup enabled.

Fixes a regression where the register tab is activated, even if sign-up enabled is not activated in application_settings.

https://gitlab.com/gitlab-org/gitlab-ce/issues/23654

See merge request !7058
Signed-off-by: default avatarRémy Coutable <remy@rymai.me>
parent 01bb7673
...@@ -11,6 +11,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -11,6 +11,7 @@ Please view this file on the master branch, on stable branches it's out of date.
- Remove extra line for empty issue description. !7045 - Remove extra line for empty issue description. !7045
- Fix error in generating labels. !7055 - Fix error in generating labels. !7055
- Stop clearing the database cache on `rake cache:clear`. !7056 - Stop clearing the database cache on `rake cache:clear`. !7056
- Only show register tab if signup enabled. !7058
## 8.13.0 (2016-10-22) ## 8.13.0 (2016-10-22)
......
%ul.nav-links.new-session-tabs.nav-tabs{ role: 'tablist'} %ul.nav-links.new-session-tabs.nav-tabs{ role: 'tablist'}
%li.active{ role: 'presentation' } %li.active{ role: 'presentation' }
%a{ href: '#login-pane', data: { toggle: 'tab' }, role: 'tab'} Sign in %a{ href: '#login-pane', data: { toggle: 'tab' }, role: 'tab'} Sign in
- if signin_enabled? && signup_enabled?
%li{ role: 'presentation'} %li{ role: 'presentation'}
%a{ href: '#register-pane', data: { toggle: 'tab' }, role: 'tab'} Register %a{ href: '#register-pane', data: { toggle: 'tab' }, role: 'tab'} Register
...@@ -215,4 +215,69 @@ feature 'Login', feature: true do ...@@ -215,4 +215,69 @@ feature 'Login', feature: true do
end end
end end
end end
describe 'UI tabs and panes' do
context 'when no defaults are changed' do
it 'correctly renders tabs and panes' do
ensure_tab_pane_correctness
end
end
context 'when signup is disabled' do
before do
stub_application_setting(signup_enabled: false)
end
it 'correctly renders tabs and panes' do
ensure_tab_pane_correctness
end
end
context 'when ldap is enabled' do
before do
visit new_user_session_path
allow(page).to receive(:form_based_providers).and_return([:ldapmain])
allow(page).to receive(:ldap_enabled).and_return(true)
end
it 'correctly renders tabs and panes' do
ensure_tab_pane_correctness(false)
end
end
context 'when crowd is enabled' do
before do
visit new_user_session_path
allow(page).to receive(:form_based_providers).and_return([:crowd])
allow(page).to receive(:crowd_enabled?).and_return(true)
end
it 'correctly renders tabs and panes' do
ensure_tab_pane_correctness(false)
end
end
def ensure_tab_pane_correctness(visit_path = true)
if visit_path
visit new_user_session_path
end
ensure_tab_pane_counts
ensure_one_active_tab
ensure_one_active_pane
end
def ensure_tab_pane_counts
tabs_count = page.all('[role="tab"]').size
expect(page).to have_selector('[role="tabpanel"]', count: tabs_count)
end
def ensure_one_active_tab
expect(page).to have_selector('.nav-tabs > li.active', count: 1)
end
def ensure_one_active_pane
expect(page).to have_selector('.tab-pane.active', count: 1)
end
end
end end
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment