Commit af53ab8f authored by Kushal Pandya's avatar Kushal Pandya

Merge branch '263158-dropdown' into 'master'

Make labels sort dropdown pajamas compliant

See merge request gitlab-org/gitlab!80702
parents 9974b1b4 47dee9f2
- sort_title = label_sort_options_hash[@sort] || sort_title_name_desc
.dropdown.inline
%button.dropdown-menu-toggle{ type: 'button', data: { toggle: 'dropdown' } }
= sort_title
= sprite_icon('chevron-down', css_class: 'dropdown-menu-toggle-icon gl-top-3')
%ul.dropdown-menu.dropdown-menu-right.dropdown-menu-sort
%li
- label_sort_options_hash.each do |value, title|
= sortable_item(title, page_filter_path(sort: value), sort_title)
- label_sort_options = label_sort_options_hash.map { |value, text| { value: value, text: text, href: page_filter_path(sort: value) } }
= gl_redirect_listbox_tag label_sort_options, @sort, data: { right: true }
......@@ -28,7 +28,7 @@ RSpec.describe 'Sort labels', :js do
it 'sorts by date' do
click_button 'Name'
sort_options = find('ul.dropdown-menu-sort li').all('a').collect(&:text)
sort_options = find('ul.dropdown-menu').all('li').collect(&:text)
expect(sort_options[0]).to eq('Name')
expect(sort_options[1]).to eq('Name, descending')
......@@ -37,7 +37,7 @@ RSpec.describe 'Sort labels', :js do
expect(sort_options[4]).to eq('Updated date')
expect(sort_options[5]).to eq('Oldest updated')
click_link 'Name, descending'
click_button 'Name, descending'
# assert default sorting
within '.other-labels' do
......
......@@ -28,7 +28,7 @@ RSpec.describe 'Sort labels', :js do
it 'sorts by date' do
click_button 'Name'
sort_options = find('ul.dropdown-menu-sort li').all('a').collect(&:text)
sort_options = find('ul.dropdown-menu').all('li').collect(&:text)
expect(sort_options[0]).to eq('Name')
expect(sort_options[1]).to eq('Name, descending')
......@@ -37,7 +37,7 @@ RSpec.describe 'Sort labels', :js do
expect(sort_options[4]).to eq('Updated date')
expect(sort_options[5]).to eq('Oldest updated')
click_link 'Name, descending'
click_button 'Name, descending'
# assert default sorting
within '.other-labels' 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