Project

General

Profile

Feature #38402 » 0002-Group-text-filters-in-the-filter-select-list.patch

Go MAEDA, 2023-04-02 10:10

View differences:

app/helpers/queries_helper.rb
43 43
        group = :label_time_tracking
44 44
      elsif %w(attachment attachment_description).include?(field)
45 45
        group = :label_attachment
46
      elsif [:string, :text, :search].include?(field_options[:type])
47
        group = :label_string
46 48
      end
47 49
      if group
48 50
        (grouped[group] ||= []) << [field_options[:name], field]
test/helpers/queries_helper_test.rb
82 82
    end
83 83
  end
84 84

  
85
  def test_filters_options_for_select_should_group_text_filters
86
    with_locale 'en' do
87
      options = filters_options_for_select(IssueQuery.new)
88
      assert_select_in options, 'optgroup[label=?]', 'Text', 1
89
      assert_select_in options, 'optgroup > option[value=subject]', :text => 'Subject'
90
      assert_select_in options, 'optgroup > option[value=cf_2]', :text => 'Searchable field'
91
      assert_select_in options, 'optgroup > option:last-of-type[value=any_searchable]', :text => 'Any searchable text'
92
    end
93
  end
94

  
85 95
  def test_query_to_csv_should_translate_boolean_custom_field_values
86 96
    f = IssueCustomField.generate!(:field_format => 'bool', :name => 'Boolean', :is_for_all => true, :trackers => Tracker.all)
87 97
    issues = [
(3-3/8)