Commit 7aa67688 authored by Jacob Schatz's avatar Jacob Schatz

Merge branch 'label-filter-fix' into 'master'

Fixed issue where label filtering didnt work

## What does this MR do?

The filterable option was missing which meant labels in the dropdown couldn't be filtered. This fixes that.

## What are the relevant issue numbers?

Closes #18375 

See merge request !4556
parents 133d5c1c d301791c
...@@ -254,7 +254,7 @@ class @LabelsSelect ...@@ -254,7 +254,7 @@ class @LabelsSelect
search: search:
fields: ['title'] fields: ['title']
selectable: true selectable: true
filterable: true
toggleLabel: (selected, el) -> toggleLabel: (selected, el) ->
selected_labels = $('.js-label-select').siblings('.dropdown-menu-labels').find('.is-active') selected_labels = $('.js-label-select').siblings('.dropdown-menu-labels').find('.is-active')
......
...@@ -67,9 +67,9 @@ module DropdownsHelper ...@@ -67,9 +67,9 @@ module DropdownsHelper
end end
end end
def dropdown_filter(placeholder) def dropdown_filter(placeholder, search_id: nil)
content_tag :div, class: "dropdown-input" do content_tag :div, class: "dropdown-input" do
filter_output = search_field_tag nil, nil, class: "dropdown-input-field", placeholder: placeholder filter_output = search_field_tag search_id, nil, class: "dropdown-input-field", placeholder: placeholder
filter_output << icon('search', class: "dropdown-input-search") filter_output << icon('search', class: "dropdown-input-search")
filter_output << icon('times', class: "dropdown-input-clear js-dropdown-input-clear", role: "button") filter_output << icon('times', class: "dropdown-input-clear js-dropdown-input-clear", role: "button")
......
...@@ -4,7 +4,7 @@ ...@@ -4,7 +4,7 @@
- filter_placeholder = local_assigns.fetch(:filter_placeholder, 'Search labels') - filter_placeholder = local_assigns.fetch(:filter_placeholder, 'Search labels')
.dropdown-page-one .dropdown-page-one
= dropdown_title(title) = dropdown_title(title)
= dropdown_filter(filter_placeholder) = dropdown_filter(filter_placeholder, search_id: "label-name")
= dropdown_content = dropdown_content
- if @project && show_footer - if @project && show_footer
= dropdown_footer do = dropdown_footer do
......
...@@ -199,4 +199,19 @@ feature 'Issue filtering by Labels', feature: true do ...@@ -199,4 +199,19 @@ feature 'Issue filtering by Labels', feature: true do
end end
end end
end end
context 'dropdown filtering', js: true do
it 'should filter by label name' do
page.within '.labels-filter' do
click_button 'Label'
wait_for_ajax
fill_in 'label-name', with: 'bug'
page.within '.dropdown-content' do
expect(page).not_to have_content 'enhancement'
expect(page).to have_content 'bug'
end
end
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