diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-14 12:10:24 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2021-05-14 12:10:24 +0300 |
commit | c19bb4adbf354562715ba019892f464080eba850 (patch) | |
tree | 880860d58bc78a904d474221c9725337a7823ee9 /spec/views | |
parent | 94a191f3d969724031efb9b15cdfd97a5af6defa (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb | 72 |
1 files changed, 60 insertions, 12 deletions
diff --git a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb index fafd5777f93..694ba0f1f4f 100644 --- a/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb +++ b/spec/views/layouts/nav/sidebar/_project.html.haml_spec.rb @@ -72,6 +72,27 @@ RSpec.describe 'layouts/nav/sidebar/_project' do expect(rendered).to have_link('Releases', href: project_releases_path(project), class: 'shortcuts-project-releases') end end + + describe 'Labels' do + let(:page) { Nokogiri::HTML.parse(rendered) } + + it 'has a link to the labels path' do + render + + expect(page.at_css('.shortcuts-project').parent.css('[aria-label="Labels"]')).not_to be_empty + expect(rendered).to have_link('Labels', href: project_labels_path(project)) + end + + context 'when feature flag :sidebar_refactor is disabled' do + it 'does not have the labels menu item' do + stub_feature_flags(sidebar_refactor: false) + + render + + expect(page.at_css('.shortcuts-project').parent.css('[aria-label="Labels"]')).to be_empty + end + end + end end describe 'Learn GitLab' do @@ -181,10 +202,23 @@ RSpec.describe 'layouts/nav/sidebar/_project' do end describe 'Labels' do - it 'has a link to the labels path' do + let(:page) { Nokogiri::HTML.parse(rendered) } + + it 'does not have a link to the labels page' do render - expect(rendered).to have_link('Labels', href: project_labels_path(project)) + expect(page.at_css('.shortcuts-issues').parent.css('[aria-label="Labels"]')).to be_empty + end + + context 'when feature flag :sidebar_refactor is disabled' do + it 'has a link to the labels page' do + stub_feature_flags(sidebar_refactor: false) + + render + + expect(page.at_css('.shortcuts-issues').parent.css('[aria-label="Labels"]')).not_to be_empty + expect(rendered).to have_link('Labels', href: project_labels_path(project)) + end end end @@ -248,21 +282,35 @@ RSpec.describe 'layouts/nav/sidebar/_project' do end describe 'Labels' do - context 'when issues are not enabled' do - it 'has a link to the labels path' do - project.project_feature.update!(issues_access_level: ProjectFeature::DISABLED) + it 'does not show the labels menu' do + project.project_feature.update!(issues_access_level: ProjectFeature::DISABLED) - render + render - expect(rendered).to have_link('Labels', href: project_labels_path(project), class: 'shortcuts-labels') - end + expect(rendered).not_to have_link('Labels', href: project_labels_path(project), class: 'shortcuts-labels') end - context 'when issues are enabled' do - it 'does not have a link to the labels path' do - render + context 'when feature flag :sidebar_refactor is disabled' do + before do + stub_feature_flags(sidebar_refactor: false) + end + + context 'when issues are not enabled' do + it 'has a link to the labels path' do + project.project_feature.update!(issues_access_level: ProjectFeature::DISABLED) - expect(rendered).not_to have_link('Labels', href: project_labels_path(project), class: 'shortcuts-labels') + render + + expect(rendered).to have_link('Labels', href: project_labels_path(project), class: 'shortcuts-labels') + end + end + + context 'when issues are enabled' do + it 'does not have a link to the labels path' do + render + + expect(rendered).not_to have_link('Labels', href: project_labels_path(project), class: 'shortcuts-labels') + end end end end |