diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-30 12:13:59 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2023-11-30 12:13:59 +0300 |
commit | 1aa447601c6be1e964acbb674887649dab23b804 (patch) | |
tree | f92778e2362ba9d7118bee2b02428647ccbcab4d /spec/views | |
parent | 010d26e381cbdd763212ace65e4b1dc7153f44a9 (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views')
-rw-r--r-- | spec/views/layouts/_header_search.html.haml_spec.rb | 113 |
1 files changed, 0 insertions, 113 deletions
diff --git a/spec/views/layouts/_header_search.html.haml_spec.rb b/spec/views/layouts/_header_search.html.haml_spec.rb deleted file mode 100644 index 3a21bb3a92c..00000000000 --- a/spec/views/layouts/_header_search.html.haml_spec.rb +++ /dev/null @@ -1,113 +0,0 @@ -# frozen_string_literal: true - -require 'spec_helper' - -RSpec.describe 'layouts/_header_search' do - let(:project) { nil } - let(:group) { nil } - let(:scope) { nil } - let(:ref) { nil } - let(:code_search) { false } - let(:for_snippets) { false } - - let(:header_search_context) do - { - project: project, - group: group, - scope: scope, - ref: ref, - code_search: code_search, - for_snippets: for_snippets - } - end - - before do - allow(view).to receive(:header_search_context).and_return(header_search_context) - end - - shared_examples 'hidden fields are properly set' do - context 'when search_context has a scope value' do - let(:scope) { 'issues' } - - it 'sets scope input to issues' do - render - - expect(rendered).to have_css("input[name='scope'][value='#{scope}']", count: 1, visible: false) - end - end - - context 'when search_context has a code_search value' do - let(:code_search) { true } - - it 'sets search_code input to true' do - render - - expect(rendered).to have_css("input[name='search_code'][value='#{code_search}']", count: 1, visible: false) - end - end - - context 'when search_context has a ref value' do - let(:ref) { 'test-branch' } - - it 'sets repository_ref input to test-branch' do - render - - expect(rendered).to have_css("input[name='repository_ref'][value='#{ref}']", count: 1, visible: false) - end - end - - context 'when search_context has a for_snippets value' do - let(:for_snippets) { true } - - it 'sets for_snippets input to true' do - render - - expect(rendered).to have_css("input[name='snippets'][value='#{for_snippets}']", count: 1, visible: false) - end - end - - context 'nav_source' do - it 'always set to navbar' do - render - - expect(rendered).to have_css("input[name='nav_source'][value='navbar']", count: 1, visible: false) - end - end - - context 'submit button' do - it 'always renders for specs' do - render - - expect(rendered).to have_css('noscript button', text: 'Search') - end - end - end - - context 'when doing a project level search' do - let(:project) do - { id: 123, name: 'foo' } - end - - it 'sets project_id field' do - render - - expect(rendered).to have_css("input[name='project_id'][value='#{project[:id]}']", count: 1, visible: false) - end - - it_behaves_like 'hidden fields are properly set' - end - - context 'when doing a group level search' do - let(:group) do - { id: 123, name: 'bar' } - end - - it 'sets group_id field' do - render - - expect(rendered).to have_css("input[name='group_id'][value='#{group[:id]}']", count: 1, visible: false) - end - - it_behaves_like 'hidden fields are properly set' - end -end |