Project

General

Profile

Defect #5593 » 5593-r17235.patch

Mizuki ISHIKAWA, 2018-03-14 06:11

View differences:

app/helpers/workflows_helper.rb
78 78
    w = workflows.select {|w| w.old_status == old_status && w.new_status == new_status}.size
79 79
    
80 80
    tag_name = "transitions[#{ old_status.try(:id) || 0 }][#{new_status.id}][#{name}]"
81
    if w == 0 || w == @roles.size * @trackers.size
82
      
81
    if old_status == new_status
82
      check_box_tag(tag_name, "1", true,
83
        {:disabled => true, :class => "old-status-#{old_status.try(:id) || 0} new-status-#{new_status.id}"})
84
    elsif w == 0 || w == @roles.size * @trackers.size
83 85
      hidden_field_tag(tag_name, "0", :id => nil) +
84 86
      check_box_tag(tag_name, "1", w != 0,
85 87
            :class => "old-status-#{old_status.try(:id) || 0} new-status-#{new_status.id}")
test/functional/workflows_controller_test.rb
110 110
    assert_equal ["New issue"] + statuses,
111 111
      css_select('table.workflows.transitions-always tbody tr td:first').map(&:text).map(&:strip)
112 112

  
113
    assert_select 'input[type=checkbox][name=?]', 'transitions[1][1][always]'
113
    assert_select 'input[type=checkbox][name=?]', 'transitions[0][1][always]'
114
  end
115

  
116
  def test_get_edit_should_show_checked_disabled_transition_checkbox_between_same_statuses
117
    get :edit, :params => {:role_id => 2, :tracker_id => 1}
118
    assert_response :success
119
    assert_select 'table.workflows.transitions-always tbody tr:nth-child(2)' do
120
      assert_select 'td.name', :text => 'New'
121
      # assert that the checkbox is disabled and checked
122
      assert_select "input[name='transitions[1][1][always]'][checked=?][disabled=?]", 'checked', 'disabled', 1
123
    end
114 124
  end
115 125

  
116 126
  def test_post_edit
(9-9/12)