02-select-and-apply-tracker_r1785.patch

Marius BALTEANU, 2018-01-28 21:07

Download (1.76 KB)

View differences:

app/views/issues/_trackers_description.html.erb
4 4
      <dl>
5 5
      <% trackers.each do |tracker| %>
6 6
        <% if tracker.description.present? %>
7
          <dt><%= tracker.name %></dt>
7
          <dt><%= content_tag 'a', tracker.name, :onclick => "selectTracker('#{tracker.id}'); return false;", :href => '#', :title => l(:text_select_apply_tracker) %></dt>
8 8
          <dd><%= tracker.description %></dd>
9 9
        <% end %>
10 10
      <% end %>
11 11
      </dl>
12 12
  </div>
13 13
<% end %>
14
<%= javascript_tag do %>
15
  function selectTracker(id) {
16
    var target = $('#issue_tracker_id');
17
    target.attr("selected", false);
18
    target.find('option[value="' + id + '"]').prop('selected', true);
19
    target.trigger('change');
20
    hideModal('#trackers_description h3');
21
  }
22
<% end %>
test/system/issues_test.rb
338 338
    subjects = csv.map {|row| row[subject_index]}
339 339
    assert_equal subjects.sort, subjects
340 340
  end
341

  
342
  def test_issue_trackers_description_should_select_tracker
343
    log_user('admin', 'admin')
344

  
345
    visit '/issues/1'
346
    page.first(:link, 'Edit').click
347
    page.click_link('View all trackers description')
348
    assert page.has_css?('#trackers_description')
349
    within('#trackers_description') do
350
      click_link('Feature')
351
    end
352

  
353
    assert !page.has_css?('#trackers_description')
354
    assert_equal "2", page.find('select#issue_tracker_id').value
355
  end
341 356
end