summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacob Schatz <jschatz1@gmail.com>2016-04-13 13:24:44 +0000
committerJacob Schatz <jschatz1@gmail.com>2016-04-13 13:24:44 +0000
commitf026e53c4df5b0b3bb7435c05d3c8662afe45881 (patch)
tree14221dac3a8d8ba973d0970059dc8de930b1d51c
parentc74604699269a2edbbe937309cce7a4ed789cb07 (diff)
parenta6ba94dbd109637b996246601f1bc2b62dc0a8d7 (diff)
downloadgitlab-ce-f026e53c4df5b0b3bb7435c05d3c8662afe45881.tar.gz
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
-rw-r--r--app/assets/javascripts/labels_select.js.coffee2
-rw-r--r--app/views/shared/issuable/_label_dropdown.html.haml2
-rw-r--r--spec/features/issues/filter_issues_spec.rb31
3 files changed, 33 insertions, 2 deletions
diff --git a/app/assets/javascripts/labels_select.js.coffee b/app/assets/javascripts/labels_select.js.coffee
index d1fe116397a..90385621879 100644
--- a/app/assets/javascripts/labels_select.js.coffee
+++ b/app/assets/javascripts/labels_select.js.coffee
@@ -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
diff --git a/app/views/shared/issuable/_label_dropdown.html.haml b/app/views/shared/issuable/_label_dropdown.html.haml
index fd5e58c1f1f..f722e61eeac 100644
--- a/app/views/shared/issuable/_label_dropdown.html.haml
+++ b/app/views/shared/issuable/_label_dropdown.html.haml
@@ -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')
diff --git a/spec/features/issues/filter_issues_spec.rb b/spec/features/issues/filter_issues_spec.rb
index 90822a8c123..69b22232f10 100644
--- a/spec/features/issues/filter_issues_spec.rb
+++ b/spec/features/issues/filter_issues_spec.rb
@@ -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