Project

General

Profile

Feature #442 » 02_select_and_apply_tracker.patch

Marius BĂLTEANU, 2017-05-21 21:51

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/ui/issues_test_ui.rb
49 49
    # check issue attributes
50 50
    assert_equal 'jsmith', issue.author.login
51 51
    assert_equal 1, issue.project.id
52
    assert_equal IssueStatus.find_by_name('New'), issue.status 
52
    assert_equal IssueStatus.find_by_name('New'), issue.status
53 53
    assert_equal Tracker.find_by_name('Bug'), issue.tracker
54 54
    assert_equal IssuePriority.find_by_name('Low'), issue.priority
55 55
    assert_equal 'Value for field 2', issue.custom_field_value(CustomField.find_by_name('Searchable field'))
......
298 298
      # Check that the page shows the Estimated hours total
299 299
      assert page.has_css?('p.query-totals')
300 300
      assert page.has_css?('span.total-for-estimated-hours')
301
      # Open the Options of the form (necessary for having the totalable columns options clickable) 
301
      # Open the Options of the form (necessary for having the totalable columns options clickable)
302 302
      page.all('legend')[1].click
303
      # Deselect the default totalable column (none should be left) 
303
      # Deselect the default totalable column (none should be left)
304 304
      page.first('input[name="t[]"][value="estimated_hours"]').click
305 305
      within('#query_form') do
306 306
        click_link 'Apply'
......
332 332
    sleep 1
333 333
    assert_equal 'Updated notes', Journal.find(2).notes
334 334
  end
335

  
336
  def test_issue_trackers_description_should_select_tracker
337
    log_user('admin', 'admin')
338

  
339
    visit '/issues/1'
340
    page.first(:link, 'Edit').click
341
    page.click_link('View all trackers description')
342
    assert page.has_css?('#trackers_description')
343
    within('#trackers_description') do
344
      click_link('Feature')
345
    end
346

  
347
    assert !page.has_css?('#trackers_description')
348
    assert_equal "2", page.find('select#issue_tracker_id').value
349
  end
335 350
end
(2-2/7)