Commit dc5107dd authored by Nur Rony's avatar Nur Rony

resolves weight dropdown not stay selected issue

Changelog entry added in CHANGELOG-EE.md

adds test for weight dropdown selected text

uses Issue weight constant from Issue class

resolves rubocop test errors by using ruby 1.9 syntax for RSpec

adds new helper module for ee issueables

removes weight_dropdown_label function from issuable_helpers

make it working for numarics weight

moves changelog entry to 8.14 and rubocop warning resolved

adds line break after release version
parent f19caa89
...@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date. ...@@ -2,6 +2,7 @@ Please view this file on the master branch, on stable branches it's out of date.
## 8.14.0 (2016-11-22) ## 8.14.0 (2016-11-22)
- Weight dropdown in issue filter form does not stay selected !826
- gitlab:check rake task checks ES version according to requirements - gitlab:check rake task checks ES version according to requirements
- Convert ASCII-8BIT LDAP DNs to UTF-8 to avoid unnecessary user deletions - Convert ASCII-8BIT LDAP DNs to UTF-8 to avoid unnecessary user deletions
- [Fix] Only owner can see "Projects" button in group edit menu - [Fix] Only owner can see "Projects" button in group edit menu
......
module EeIssuablesHelper
def weight_dropdown_label(weight)
if Issue.weight_options.include?(weight)
weight
else
h(weight.presence || 'Weight')
end
end
end
...@@ -33,7 +33,7 @@ ...@@ -33,7 +33,7 @@
.filter-item.inline.weight-filter .filter-item.inline.weight-filter
- if params[:weight] - if params[:weight]
= hidden_field_tag(:weight, params[:weight]) = hidden_field_tag(:weight, params[:weight])
= dropdown_tag("Weight", options: { title: "Filter by weight", toggle_class: 'js-weight-select js-filter-submit', dropdown_class: "dropdown-menu-selectable", = dropdown_tag(weight_dropdown_label(params[:weight]), options: { title: "Filter by weight", toggle_class: 'js-weight-select js-filter-submit', dropdown_class: "dropdown-menu-selectable",
placeholder: "Search weight", data: { field_name: "weight" , default_label: "Weight" } }) do placeholder: "Search weight", data: { field_name: "weight" , default_label: "Weight" } }) do
%ul %ul
- Issue.weight_options.each do |weight| - Issue.weight_options.each do |weight|
......
...@@ -14,6 +14,7 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -14,6 +14,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues(project) visit_issues(project)
filter_by_weight(Issue::WEIGHT_NONE) filter_by_weight(Issue::WEIGHT_NONE)
expect(page).to have_css('.weight-filter .dropdown-toggle-text', text: Issue::WEIGHT_NONE)
expect(page).to have_css('.issue', count: 1) expect(page).to have_css('.issue', count: 1)
end end
...@@ -21,6 +22,7 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -21,6 +22,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues(project) visit_issues(project)
filter_by_weight(Issue::WEIGHT_ANY) filter_by_weight(Issue::WEIGHT_ANY)
expect(page).to have_css('.weight-filter .dropdown-toggle-text', text: Issue::WEIGHT_ANY)
expect(page).to have_css('.issue', count: 2) expect(page).to have_css('.issue', count: 2)
end end
...@@ -28,6 +30,7 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -28,6 +30,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues(project) visit_issues(project)
filter_by_weight(weight_num) filter_by_weight(weight_num)
expect(page).to have_css('.weight-filter .dropdown-toggle-text', text: weight_num)
expect(page).to have_css('.issue', count: 2) expect(page).to have_css('.issue', count: 2)
end end
...@@ -35,6 +38,7 @@ feature 'Issue filtering by Weight', feature: true do ...@@ -35,6 +38,7 @@ feature 'Issue filtering by Weight', feature: true do
visit_issues(project) visit_issues(project)
filter_by_weight(Issue::WEIGHT_ALL) filter_by_weight(Issue::WEIGHT_ALL)
expect(page).to have_css('.weight-filter .dropdown-toggle-text', text: Issue::WEIGHT_ALL)
expect(page).to have_css('.issue', count: 3) expect(page).to have_css('.issue', count: 3)
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