Project

General

Profile

Defect #5593 » 5593-r17235.patch

Mizuki ISHIKAWA, 2018-03-14 06:11

View differences:

app/helpers/workflows_helper.rb
w = workflows.select {|w| w.old_status == old_status && w.new_status == new_status}.size
tag_name = "transitions[#{ old_status.try(:id) || 0 }][#{new_status.id}][#{name}]"
if w == 0 || w == @roles.size * @trackers.size
if old_status == new_status
check_box_tag(tag_name, "1", true,
{:disabled => true, :class => "old-status-#{old_status.try(:id) || 0} new-status-#{new_status.id}"})
elsif w == 0 || w == @roles.size * @trackers.size
hidden_field_tag(tag_name, "0", :id => nil) +
check_box_tag(tag_name, "1", w != 0,
:class => "old-status-#{old_status.try(:id) || 0} new-status-#{new_status.id}")
test/functional/workflows_controller_test.rb
assert_equal ["New issue"] + statuses,
css_select('table.workflows.transitions-always tbody tr td:first').map(&:text).map(&:strip)
assert_select 'input[type=checkbox][name=?]', 'transitions[1][1][always]'
assert_select 'input[type=checkbox][name=?]', 'transitions[0][1][always]'
end
def test_get_edit_should_show_checked_disabled_transition_checkbox_between_same_statuses
get :edit, :params => {:role_id => 2, :tracker_id => 1}
assert_response :success
assert_select 'table.workflows.transitions-always tbody tr:nth-child(2)' do
assert_select 'td.name', :text => 'New'
# assert that the checkbox is disabled and checked
assert_select "input[name='transitions[1][1][always]'][checked=?][disabled=?]", 'checked', 'disabled', 1
end
end
def test_post_edit
(9-9/12)