Commit cfe04803 authored by James Lopez's avatar James Lopez

Merge branch 'wiki-search-results-fix' into 'master'

Fix links to wiki pages with subdirectories in search

Closes #56234

See merge request gitlab-org/gitlab-ce!27400
parents 33d5ec5b 2f36efa0
- project = find_project_for_result_blob(projects, wiki_blob) - project = find_project_for_result_blob(projects, wiki_blob)
- wiki_blob = parse_search_result(wiki_blob) - wiki_blob = parse_search_result(wiki_blob)
- wiki_blob_link = project_wiki_path(project, wiki_blob.basename) - wiki_blob_link = project_wiki_path(project, Pathname.new(wiki_blob.filename).sub_ext(''))
= render partial: 'search/results/blob_data', locals: { blob: wiki_blob, project: project, file_name: wiki_blob.filename, blob_link: wiki_blob_link } = render partial: 'search/results/blob_data', locals: { blob: wiki_blob, project: project, file_name: wiki_blob.filename, blob_link: wiki_blob_link }
---
title: fix wiki search result links in titles
merge_request: 27400
author: khm
type: fixed
...@@ -14,22 +14,36 @@ describe 'User searches for wiki pages', :js do ...@@ -14,22 +14,36 @@ describe 'User searches for wiki pages', :js do
include_examples 'top right search form' include_examples 'top right search form'
it 'finds a page' do shared_examples 'search wiki blobs' do
find('.js-search-project-dropdown').click it 'finds a page' do
find('.js-search-project-dropdown').click
page.within('.project-filter') do page.within('.project-filter') do
click_link(project.full_name) click_link(project.full_name)
end end
fill_in('dashboard_search', with: 'content')
find('.btn-search').click
page.within('.search-filter') do
click_link('Wiki')
end
fill_in('dashboard_search', with: 'content') page.within('.results') do
find('.btn-search').click expect(find(:css, '.search-results')).to have_link(wiki_page.title, href: project_wiki_path(project, wiki_page.slug))
end
end
end
page.within('.search-filter') do context 'when searching by content' do
click_link('Wiki') it_behaves_like 'search wiki blobs' do
let(:search_term) { 'content' }
end end
end
page.within('.results') do context 'when searching by title' do
expect(find(:css, '.search-results')).to have_link(wiki_page.title) it_behaves_like 'search wiki blobs' do
let(:search_term) { 'test_wiki' }
end end
end end
end end
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