From c19bb4adbf354562715ba019892f464080eba850 Mon Sep 17 00:00:00 2001 From: GitLab Bot Date: Fri, 14 May 2021 09:10:24 +0000 Subject: Add latest changes from gitlab-org/gitlab@master --- .../layouts/nav/sidebar/_project.html.haml_spec.rb | 72 ++++++++++++++++++---- 1 file changed, 60 insertions(+), 12 deletions(-) (limited to 'spec/views') 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 -- cgit v1.2.3