diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-17 09:08:26 +0300 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2022-03-17 09:08:26 +0300 |
commit | 2fff82c54ce215aceabe5b5236fafeea005d4eee (patch) | |
tree | 9e751ece337740c76f7ab1330cff33e533f79291 /spec/views/search | |
parent | e6ac8e40c2c0fa317c319469d5102eec8be7becd (diff) |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/views/search')
-rw-r--r-- | spec/views/search/_results.html.haml_spec.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/views/search/_results.html.haml_spec.rb b/spec/views/search/_results.html.haml_spec.rb index 515ec62fe3c..72e2d7131c0 100644 --- a/spec/views/search/_results.html.haml_spec.rb +++ b/spec/views/search/_results.html.haml_spec.rb @@ -96,6 +96,31 @@ RSpec.describe 'search/_results' do end end + describe 'git blame click tracking' do + let(:scope) { 'blobs' } + let(:search_objects) { Gitlab::ProjectSearchResults.new(user, 'testing', project: project).objects(scope) } + + context 'when admin mode is enabled', :enable_admin_mode do + it 'renders the click link event tracking attributes' do + render + + expect(rendered).to have_selector('[data-track-action=click_link]') + expect(rendered).to have_selector('[data-track-label=git_blame]') + expect(rendered).to have_selector('[data-track-property=search_result]') + end + end + + context 'when admin mode is disabled' do + it 'does not render the click link event tracking attributes' do + render + + expect(rendered).not_to have_selector('[data-track-action=click_link]') + expect(rendered).not_to have_selector('[data-track-label=git_blame]') + expect(rendered).not_to have_selector('[data-track-property=search_result]') + end + end + end + %w[blobs notes wiki_blobs milestones].each do |search_scope| context "when scope is #{search_scope}" do let(:scope) { search_scope } |