Commit 13d3e75a authored by Nick Kipling's avatar Nick Kipling

Fixes wrong title for type and updated tests

parent 91294fbd
...@@ -9,7 +9,7 @@ module Groups ...@@ -9,7 +9,7 @@ module Groups
def index def index
@packages = ::Packages::GroupPackagesFinder.new(current_user, group) @packages = ::Packages::GroupPackagesFinder.new(current_user, group)
.execute .execute
.sort_by_attribute(@sort = params[:sort] || 'created_desc') .sort_by_attribute(@sort = params[:sort] || sort_value_recently_created)
.page(params[:page]) .page(params[:page])
end end
......
...@@ -72,7 +72,7 @@ module EE ...@@ -72,7 +72,7 @@ module EE
sort_value_name_desc => sort_title_name, sort_value_name_desc => sort_title_name,
sort_value_version_desc => sort_title_version, sort_value_version_desc => sort_title_version,
sort_value_version_asc => sort_title_version, sort_value_version_asc => sort_title_version,
sort_value_type_desc => sort_value_type_desc, sort_value_type_desc => sort_title_type,
sort_value_type_asc => sort_title_type, sort_value_type_asc => sort_title_type,
sort_value_project_name_desc => sort_title_project_name, sort_value_project_name_desc => sort_title_project_name,
sort_value_project_name_asc => sort_title_project_name sort_value_project_name_asc => sort_title_project_name
......
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
.dropdown.inline.prepend-top-default.append-bottom-default.package-sort-dropdown .dropdown.inline.prepend-top-default.append-bottom-default.package-sort-dropdown
.btn-group{ role: 'group' } .btn-group{ role: 'group' }
.btn-group{ role: 'group' } .btn-group{ role: 'group' }
%button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static' }, class: 'btn btn-default' } %button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown', display: 'static', 'qa-selector': 'sort-dropdown-button' }, class: 'btn btn-default' }
= sort_title = sort_title
= icon('chevron-down') = icon('chevron-down')
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort %ul.dropdown-menu.dropdown-menu-right.dropdown-menu-selectable.dropdown-menu-sort
...@@ -32,7 +32,7 @@ ...@@ -32,7 +32,7 @@
.table-section.section-20{ role: 'rowheader' } .table-section.section-20{ role: 'rowheader' }
= _('Created') = _('Created')
- @packages.each do |package| - @packages.each do |package|
.gl-responsive-table-row.package-row .gl-responsive-table-row{ data: { 'qa-selector': 'package-row' } }
.table-section.section-30 .table-section.section-30
.table-mobile-header{ role: "rowheader" }= _("Name") .table-mobile-header{ role: "rowheader" }= _("Name")
.table-mobile-content.flex-truncate-parent .table-mobile-content.flex-truncate-parent
......
...@@ -78,49 +78,57 @@ describe 'Group Packages' do ...@@ -78,49 +78,57 @@ describe 'Group Packages' do
end end
it 'sorts by created date descending' do it 'sorts by created date descending' do
visit group_packages_path(group, sort: sort_value_created_date) visit group_packages_path(group, sort: sort_value_recently_created)
expect(sort_dropdown_button_text).to eq(sort_title_created_date)
expect(first_package).to include(bbb_package.name) expect(first_package).to include(bbb_package.name)
expect(last_package).to include(aaa_package.name) expect(last_package).to include(aaa_package.name)
end end
it 'sorts by created date ascending' do it 'sorts by created date ascending' do
visit group_packages_path(group, sort: sort_value_oldest_created) visit group_packages_path(group, sort: sort_value_oldest_created)
expect(sort_dropdown_button_text).to eq(sort_title_created_date)
expect(first_package).to include(aaa_package.name) expect(first_package).to include(aaa_package.name)
expect(last_package).to include(bbb_package.name) expect(last_package).to include(bbb_package.name)
end end
it 'sorts by name descending' do it 'sorts by name descending' do
visit group_packages_path(group, sort: sort_value_name_desc) visit group_packages_path(group, sort: sort_value_name_desc)
expect(sort_dropdown_button_text).to eq(sort_title_name)
expect(first_package).to include(bbb_package.name) expect(first_package).to include(bbb_package.name)
expect(last_package).to include(aaa_package.name) expect(last_package).to include(aaa_package.name)
end end
it 'sorts by name ascending' do it 'sorts by name ascending' do
visit group_packages_path(group, sort: sort_value_name) visit group_packages_path(group, sort: sort_value_name)
expect(sort_dropdown_button_text).to eq(sort_title_name)
expect(first_package).to include(aaa_package.name) expect(first_package).to include(aaa_package.name)
expect(last_package).to include(bbb_package.name) expect(last_package).to include(bbb_package.name)
end end
it 'sorts by version descending' do it 'sorts by version descending' do
visit group_packages_path(group, sort: sort_value_version_desc) visit group_packages_path(group, sort: sort_value_version_desc)
expect(sort_dropdown_button_text).to eq(sort_title_version)
expect(first_package).to include(bbb_package.name) expect(first_package).to include(bbb_package.name)
expect(last_package).to include(aaa_package.name) expect(last_package).to include(aaa_package.name)
end end
it 'sorts by version ascending' do it 'sorts by version ascending' do
visit group_packages_path(group, sort: sort_value_version_asc) visit group_packages_path(group, sort: sort_value_version_asc)
expect(sort_dropdown_button_text).to eq(sort_title_version)
expect(first_package).to include(aaa_package.name) expect(first_package).to include(aaa_package.name)
expect(last_package).to include(bbb_package.name) expect(last_package).to include(bbb_package.name)
end end
it 'sorts by project descending' do it 'sorts by project descending' do
visit group_packages_path(group, sort: sort_value_project_name_desc) visit group_packages_path(group, sort: sort_value_project_name_desc)
expect(sort_dropdown_button_text).to eq(sort_title_project_name)
expect(first_package).to include(bbb_package.name) expect(first_package).to include(bbb_package.name)
expect(last_package).to include(aaa_package.name) expect(last_package).to include(aaa_package.name)
end end
it 'sorts by project ascending' do it 'sorts by project ascending' do
visit group_packages_path(group, sort: sort_value_project_name_asc) visit group_packages_path(group, sort: sort_value_project_name_asc)
expect(sort_dropdown_button_text).to eq(sort_title_project_name)
expect(first_package).to include(aaa_package.name) expect(first_package).to include(aaa_package.name)
expect(last_package).to include(bbb_package.name) expect(last_package).to include(bbb_package.name)
end end
...@@ -132,12 +140,14 @@ describe 'Group Packages' do ...@@ -132,12 +140,14 @@ describe 'Group Packages' do
it 'sorts by type descending' do it 'sorts by type descending' do
visit group_packages_path(group, sort: sort_value_type_desc) visit group_packages_path(group, sort: sort_value_type_desc)
expect(sort_dropdown_button_text).to eq(sort_title_type)
expect(first_package).to include(npm_package.name) expect(first_package).to include(npm_package.name)
expect(last_package).to include(maven_package.name) expect(last_package).to include(maven_package.name)
end end
it 'sorts by type ascending' do it 'sorts by type ascending' do
visit group_packages_path(group, sort: sort_value_type_asc) visit group_packages_path(group, sort: sort_value_type_asc)
expect(sort_dropdown_button_text).to eq(sort_title_type)
expect(first_package).to include(maven_package.name) expect(first_package).to include(maven_package.name)
expect(last_package).to include(npm_package.name) expect(last_package).to include(npm_package.name)
end end
...@@ -148,10 +158,14 @@ describe 'Group Packages' do ...@@ -148,10 +158,14 @@ describe 'Group Packages' do
end end
def first_package def first_package
page.all('.table-holder .package-row').first.text page.all('[data-qa-selector="package-row"]').first.text
end end
def last_package def last_package
page.all('.table-holder .package-row').last.text page.all('[data-qa-selector="package-row"]').last.text
end
def sort_dropdown_button_text
page.find('[data-qa-selector="sort-dropdown-button"]').text
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