Commit e6308ade authored by Phil Hughes's avatar Phil Hughes

Merge branch '332854-add-file-copy-ability-to-code-search-results' into 'master'

Add file copy ability to code search results

See merge request gitlab-org/gitlab!65749
parents d33dde1f ea33df75
...@@ -5,6 +5,7 @@ ...@@ -5,6 +5,7 @@
= sprite_icon('document') = sprite_icon('document')
%strong %strong
= search_blob_title(project, path) = search_blob_title(project, path)
= copy_file_path_button(path)
- if blob.data - if blob.data
.file-content.code.term{ data: { qa_selector: 'file_text_content' } } .file-content.code.term{ data: { qa_selector: 'file_text_content' } }
= render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, blob_link: blob_link, highlight_line: blob.highlight_line = render 'shared/file_highlight', blob: blob, first_line_number: blob.startline, blob_link: blob_link, highlight_line: blob.highlight_line
...@@ -172,8 +172,8 @@ RSpec.describe 'Global elastic search', :elastic, :sidekiq_inline do ...@@ -172,8 +172,8 @@ RSpec.describe 'Global elastic search', :elastic, :sidekiq_inline do
select_search_scope('Code') select_search_scope('Code')
expect(page).to have_selector('.file-content .code') expect(page).to have_selector('.file-content .code')
expect(page).to have_selector("span.line[lang='javascript']") expect(page).to have_selector("span.line[lang='javascript']")
expect(page).to have_button('Copy file path')
end end
it 'ignores nonexistent projects from stale index' do it 'ignores nonexistent projects from stale index' do
......
...@@ -58,6 +58,7 @@ RSpec.describe 'Group elastic search', :js, :elastic, :sidekiq_might_not_need_in ...@@ -58,6 +58,7 @@ RSpec.describe 'Group elastic search', :js, :elastic, :sidekiq_might_not_need_in
select_search_scope('Code') select_search_scope('Code')
expect(page).to have_selector('.file-content .code') expect(page).to have_selector('.file-content .code')
expect(page).to have_button('Copy file path')
end end
end end
......
...@@ -84,6 +84,7 @@ RSpec.describe 'Project elastic search', :js, :elastic do ...@@ -84,6 +84,7 @@ RSpec.describe 'Project elastic search', :js, :elastic do
select_search_scope('Code') select_search_scope('Code')
expect(page).to have_selector('.results', text: 'def username_regex') expect(page).to have_selector('.results', text: 'def username_regex')
expect(page).to have_button('Copy file path')
end end
end end
......
...@@ -22,6 +22,7 @@ RSpec.describe 'User searches for code' do ...@@ -22,6 +22,7 @@ RSpec.describe 'User searches for code' do
expect(page).to have_selector('.file-content .code') expect(page).to have_selector('.file-content .code')
expect(page).to have_selector("span.line[lang='javascript']") expect(page).to have_selector("span.line[lang='javascript']")
expect(page).to have_link('application.js', href: %r{master/files/js/application.js}) expect(page).to have_link('application.js', href: %r{master/files/js/application.js})
expect(page).to have_button('Copy file path')
end end
context 'when on a project page', :js do context 'when on a project page', :js do
......
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