Commit e7deeddc authored by Mark Fletcher's avatar Mark Fletcher

Enable sorting by name in the Groups dropdown

parent 225980db
...@@ -44,6 +44,8 @@ module SortingHelper ...@@ -44,6 +44,8 @@ module SortingHelper
def groups_sort_options_hash 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_recently_created => sort_title_recently_created,
sort_value_oldest_created => sort_title_oldest_created, sort_value_oldest_created => sort_title_oldest_created,
sort_value_recently_updated => sort_title_recently_updated, sort_value_recently_updated => sort_title_recently_updated,
......
---
title: Enable ordering of groups and their children by name
merge_request:
author:
type: added
...@@ -73,6 +73,41 @@ describe GroupDescendantsFinder do ...@@ -73,6 +73,41 @@ describe GroupDescendantsFinder do
expect(finder.execute).to contain_exactly(matching_project) expect(finder.execute).to contain_exactly(matching_project)
end end
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 end
context 'with nested groups', :nested_groups do context 'with nested groups', :nested_groups 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