Merge branch 'fj-fix-subgroup-search-url' into 'master'
Fix subgroup url in search drop down Closes #52525 See merge request gitlab-org/gitlab-ce!30457
This commit is contained in:
commit
7301cd1422
3 changed files with 68 additions and 63 deletions
|
@ -1,5 +1,5 @@
|
||||||
- if @group && @group.persisted? && @group.path
|
- if @group && @group.persisted? && @group.path
|
||||||
- group_data_attrs = { group_path: j(@group.path), name: @group.name, issues_path: issues_group_path(j(@group.path)), mr_path: merge_requests_group_path(j(@group.path)) }
|
- group_data_attrs = { group_path: j(@group.path), name: j(@group.name), issues_path: issues_group_path(@group), mr_path: merge_requests_group_path(@group) }
|
||||||
- if @project && @project.persisted?
|
- if @project && @project.persisted?
|
||||||
- project_data_attrs = { project_path: j(@project.path), name: j(@project.name), issues_path: project_issues_path(@project), mr_path: project_merge_requests_path(@project), issues_disabled: !@project.issues_enabled? }
|
- project_data_attrs = { project_path: j(@project.path), name: j(@project.name), issues_path: project_issues_path(@project), mr_path: project_merge_requests_path(@project), issues_disabled: !@project.issues_enabled? }
|
||||||
.search.search-form{ data: { track_label: "navbar_search", track_event: "activate_form_input" } }
|
.search.search-form{ data: { track_label: "navbar_search", track_event: "activate_form_input" } }
|
||||||
|
|
5
changelogs/unreleased/fj-fix-subgroup-search-url.yml
Normal file
5
changelogs/unreleased/fj-fix-subgroup-search-url.yml
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
---
|
||||||
|
title: Fix subgroup url in search drop down
|
||||||
|
merge_request: 30457
|
||||||
|
author:
|
||||||
|
type: fixed
|
|
@ -1,6 +1,6 @@
|
||||||
require 'spec_helper'
|
require 'spec_helper'
|
||||||
|
|
||||||
describe 'User uses header search field' do
|
describe 'User uses header search field', :js do
|
||||||
include FilteredSearchHelpers
|
include FilteredSearchHelpers
|
||||||
|
|
||||||
let(:project) { create(:project) }
|
let(:project) { create(:project) }
|
||||||
|
@ -11,17 +11,37 @@ describe 'User uses header search field' do
|
||||||
sign_in(user)
|
sign_in(user)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is in a global scope', :js do
|
shared_examples 'search field examples' do
|
||||||
|
before do
|
||||||
|
visit(url)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'starts searching by pressing the enter key' do
|
||||||
|
fill_in('search', with: 'gitlab')
|
||||||
|
find('#search').native.send_keys(:enter)
|
||||||
|
|
||||||
|
page.within('.breadcrumbs-sub-title') do
|
||||||
|
expect(page).to have_content('Search')
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when clicking the search field' do
|
||||||
before do
|
before do
|
||||||
visit(root_path)
|
|
||||||
page.find('#search').click
|
page.find('#search').click
|
||||||
|
wait_for_all_requests
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'shows category search dropdown' do
|
||||||
|
expect(page).to have_selector('.dropdown-header', text: /#{scope_name}/i)
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when clicking issues' do
|
context 'when clicking issues' do
|
||||||
|
let!(:issue) { create(:issue, project: project, author: user, assignees: [user]) }
|
||||||
|
|
||||||
it 'shows assigned issues' do
|
it 'shows assigned issues' do
|
||||||
find('.search-input-container .dropdown-menu').click_link('Issues assigned to me')
|
find('.search-input-container .dropdown-menu').click_link('Issues assigned to me')
|
||||||
|
|
||||||
expect(page).to have_selector('.filtered-search')
|
expect(page).to have_selector('.issues-list .issue')
|
||||||
expect_tokens([assignee_token(user.name)])
|
expect_tokens([assignee_token(user.name)])
|
||||||
expect_filtered_search_input_empty
|
expect_filtered_search_input_empty
|
||||||
end
|
end
|
||||||
|
@ -29,7 +49,7 @@ describe 'User uses header search field' do
|
||||||
it 'shows created issues' do
|
it 'shows created issues' do
|
||||||
find('.search-input-container .dropdown-menu').click_link("Issues I've created")
|
find('.search-input-container .dropdown-menu').click_link("Issues I've created")
|
||||||
|
|
||||||
expect(page).to have_selector('.filtered-search')
|
expect(page).to have_selector('.issues-list .issue')
|
||||||
expect_tokens([author_token(user.name)])
|
expect_tokens([author_token(user.name)])
|
||||||
expect_filtered_search_input_empty
|
expect_filtered_search_input_empty
|
||||||
end
|
end
|
||||||
|
@ -41,7 +61,7 @@ describe 'User uses header search field' do
|
||||||
it 'shows assigned merge requests' do
|
it 'shows assigned merge requests' do
|
||||||
find('.search-input-container .dropdown-menu').click_link('Merge requests assigned to me')
|
find('.search-input-container .dropdown-menu').click_link('Merge requests assigned to me')
|
||||||
|
|
||||||
expect(page).to have_selector('.filtered-search')
|
expect(page).to have_selector('.mr-list .merge-request')
|
||||||
expect_tokens([assignee_token(user.name)])
|
expect_tokens([assignee_token(user.name)])
|
||||||
expect_filtered_search_input_empty
|
expect_filtered_search_input_empty
|
||||||
end
|
end
|
||||||
|
@ -49,87 +69,67 @@ describe 'User uses header search field' do
|
||||||
it 'shows created merge requests' do
|
it 'shows created merge requests' do
|
||||||
find('.search-input-container .dropdown-menu').click_link("Merge requests I've created")
|
find('.search-input-container .dropdown-menu').click_link("Merge requests I've created")
|
||||||
|
|
||||||
expect(page).to have_selector('.filtered-search')
|
expect(page).to have_selector('.mr-list .merge-request')
|
||||||
expect_tokens([author_token(user.name)])
|
expect_tokens([author_token(user.name)])
|
||||||
expect_filtered_search_input_empty
|
expect_filtered_search_input_empty
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when user is in a project scope' do
|
context 'when entering text into the search field' do
|
||||||
before do
|
|
||||||
visit(project_path(project))
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'starts searching by pressing the enter key', :js do
|
|
||||||
fill_in('search', with: 'gitlab')
|
|
||||||
find('#search').native.send_keys(:enter)
|
|
||||||
|
|
||||||
page.within('.breadcrumbs-sub-title') do
|
|
||||||
expect(page).to have_content('Search')
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when clicking the search field', :js do
|
|
||||||
before do
|
|
||||||
page.find('#search').click
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'shows category search dropdown' do
|
|
||||||
expect(page).to have_selector('.dropdown-header', text: /#{project.name}/i)
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when clicking issues' do
|
|
||||||
let!(:issue) { create(:issue, project: project, author: user, assignees: [user]) }
|
|
||||||
|
|
||||||
it 'shows assigned issues' do
|
|
||||||
find('.dropdown-menu').click_link('Issues assigned to me')
|
|
||||||
|
|
||||||
expect(page).to have_selector('.filtered-search')
|
|
||||||
expect_tokens([assignee_token(user.name)])
|
|
||||||
expect_filtered_search_input_empty
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'shows created issues' do
|
|
||||||
find('.dropdown-menu').click_link("Issues I've created")
|
|
||||||
|
|
||||||
expect(page).to have_selector('.filtered-search')
|
|
||||||
expect_tokens([author_token(user.name)])
|
|
||||||
expect_filtered_search_input_empty
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when clicking merge requests' do
|
|
||||||
let!(:merge_request) { create(:merge_request, source_project: project, author: user, assignees: [user]) }
|
|
||||||
|
|
||||||
it 'shows assigned merge requests' do
|
|
||||||
find('.dropdown-menu').click_link('Merge requests assigned to me')
|
|
||||||
|
|
||||||
expect(page).to have_selector('.merge-requests-holder')
|
|
||||||
expect_tokens([assignee_token(user.name)])
|
|
||||||
expect_filtered_search_input_empty
|
|
||||||
end
|
|
||||||
|
|
||||||
it 'shows created merge requests' do
|
|
||||||
find('.dropdown-menu').click_link("Merge requests I've created")
|
|
||||||
|
|
||||||
expect(page).to have_selector('.merge-requests-holder')
|
|
||||||
expect_tokens([author_token(user.name)])
|
|
||||||
expect_filtered_search_input_empty
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
|
|
||||||
context 'when entering text into the search field', :js do
|
|
||||||
before do
|
before do
|
||||||
page.within('.search-input-wrap') do
|
page.within('.search-input-wrap') do
|
||||||
fill_in('search', with: project.name[0..3])
|
fill_in('search', with: scope_name.first(4))
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'does not display the category search dropdown' do
|
it 'does not display the category search dropdown' do
|
||||||
expect(page).not_to have_selector('.dropdown-header', text: /#{project.name}/i)
|
expect(page).not_to have_selector('.dropdown-header', text: /#{scope_name}/i)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
context 'when user is in a global scope' do
|
||||||
|
include_examples 'search field examples' do
|
||||||
|
let(:url) { root_path }
|
||||||
|
let(:scope_name) { 'All GitLab' }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when user is in a project scope' do
|
||||||
|
include_examples 'search field examples' do
|
||||||
|
let(:url) { project_path(project) }
|
||||||
|
let(:scope_name) { project.name }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when user is in a group scope' do
|
||||||
|
let(:group) { create(:group) }
|
||||||
|
let(:project) { create(:project, namespace: group) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
group.add_maintainer(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples 'search field examples' do
|
||||||
|
let(:url) { group_path(group) }
|
||||||
|
let(:scope_name) { group.name }
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'when user is in a subgroup scope' do
|
||||||
|
let(:group) { create(:group) }
|
||||||
|
let(:subgroup) { create(:group, :public, parent: group) }
|
||||||
|
let(:project) { create(:project, namespace: subgroup) }
|
||||||
|
|
||||||
|
before do
|
||||||
|
group.add_owner(user)
|
||||||
|
subgroup.add_owner(user)
|
||||||
|
end
|
||||||
|
|
||||||
|
include_examples 'search field examples' do
|
||||||
|
let(:url) { group_path(subgroup) }
|
||||||
|
let(:scope_name) { subgroup.name }
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue