Merge branch 'label-filter' into 'master'
Fixed not being able to filter by any or no labels Brings back the options to filter by any or no label Closes #15008 ![Screen_Shot_2016-04-07_at_11.26.41](/uploads/20d949b19f537d830118532e1d44feb7/Screen_Shot_2016-04-07_at_11.26.41.png) See merge request !3589
This commit is contained in:
commit
f026e53c4d
3 changed files with 33 additions and 2 deletions
|
@ -218,7 +218,7 @@ class @LabelsSelect
|
|||
selectable: true
|
||||
|
||||
toggleLabel: (selected) ->
|
||||
if selected and selected.title isnt 'Any Label'
|
||||
if selected and selected.title?
|
||||
selected.title
|
||||
else
|
||||
defaultLabel
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
- if params[:label_name].present?
|
||||
= hidden_field_tag(:label_name, params[:label_name])
|
||||
.dropdown
|
||||
%button.dropdown-menu-toggle.js-label-select.js-filter-submit{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path, default_label: "Label"}}
|
||||
%button.dropdown-menu-toggle.js-label-select.js-filter-submit.js-extra-options{type: "button", data: {toggle: "dropdown", field_name: "label_name", show_no: "true", show_any: "true", selected: params[:label_name], project_id: @project.try(:id), labels: labels_filter_path, default_label: "Label"}}
|
||||
%span.dropdown-toggle-text
|
||||
= h(params[:label_name].presence || "Label")
|
||||
= icon('chevron-down')
|
||||
|
|
|
@ -76,6 +76,37 @@ describe 'Filter issues', feature: true do
|
|||
end
|
||||
end
|
||||
|
||||
describe 'Filter issues for label from issues#index', js: true do
|
||||
before do
|
||||
visit namespace_project_issues_path(project.namespace, project)
|
||||
find('.js-label-select').click
|
||||
end
|
||||
|
||||
it 'should filter by any label' do
|
||||
find('.dropdown-menu-labels a', text: 'Any Label').click
|
||||
page.within '.labels-filter' do
|
||||
expect(page).to have_content 'Any Label'
|
||||
end
|
||||
expect(find('.js-label-select .dropdown-toggle-text')).to have_content('Label')
|
||||
end
|
||||
|
||||
it 'should filter by no label' do
|
||||
find('.dropdown-menu-labels a', text: 'No Label').click
|
||||
page.within '.labels-filter' do
|
||||
expect(page).to have_content 'No Label'
|
||||
end
|
||||
expect(find('.js-label-select .dropdown-toggle-text')).to have_content('No Label')
|
||||
end
|
||||
|
||||
it 'should filter by no label' do
|
||||
find('.dropdown-menu-labels a', text: label.title).click
|
||||
page.within '.labels-filter' do
|
||||
expect(page).to have_content label.title
|
||||
end
|
||||
expect(find('.js-label-select .dropdown-toggle-text')).to have_content(label.title)
|
||||
end
|
||||
end
|
||||
|
||||
describe 'Filter issues for assignee and label from issues#index' do
|
||||
|
||||
before do
|
||||
|
|
Loading…
Reference in a new issue