Enable sorting by name in the Groups dropdown
This commit is contained in:
parent
225980db35
commit
e7deeddc1b
|
@ -44,6 +44,8 @@ module SortingHelper
|
|||
|
||||
def groups_sort_options_hash
|
||||
{
|
||||
sort_value_name => sort_title_name,
|
||||
sort_value_name_desc => sort_title_name_desc,
|
||||
sort_value_recently_created => sort_title_recently_created,
|
||||
sort_value_oldest_created => sort_title_oldest_created,
|
||||
sort_value_recently_updated => sort_title_recently_updated,
|
||||
|
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
title: Enable ordering of groups and their children by name
|
||||
merge_request:
|
||||
author:
|
||||
type: added
|
|
@ -73,6 +73,41 @@ describe GroupDescendantsFinder do
|
|||
expect(finder.execute).to contain_exactly(matching_project)
|
||||
end
|
||||
end
|
||||
|
||||
context 'sorting by name' do
|
||||
let!(:project1) { create(:project, namespace: group, name: 'a', path: 'project-a') }
|
||||
let!(:project2) { create(:project, namespace: group, name: 'z', path: 'project-z') }
|
||||
let(:params) do
|
||||
{
|
||||
sort: 'name_asc'
|
||||
}
|
||||
end
|
||||
|
||||
it 'sorts elements by name' do
|
||||
expect(subject.execute).to eq(
|
||||
[
|
||||
project1,
|
||||
project2
|
||||
]
|
||||
)
|
||||
end
|
||||
|
||||
context 'with nested groups', :nested_groups do
|
||||
let!(:subgroup1) { create(:group, parent: group, name: 'a', path: 'sub-a') }
|
||||
let!(:subgroup2) { create(:group, parent: group, name: 'z', path: 'sub-z') }
|
||||
|
||||
it 'sorts elements by name' do
|
||||
expect(subject.execute).to eq(
|
||||
[
|
||||
subgroup1,
|
||||
subgroup2,
|
||||
project1,
|
||||
project2
|
||||
]
|
||||
)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'with nested groups', :nested_groups do
|
||||
|
|
Loading…
Reference in New Issue