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
<dl>
<% trackers.each do |tracker| %>
<% if tracker.description.present? %>
<dt><%= tracker.name %></dt>
<dt><%= content_tag 'a', tracker.name, :onclick => "selectTracker('#{tracker.id}'); return false;", :href => '#', :title => l(:text_select_apply_tracker) %></dt>
<dd><%= tracker.description %></dd>
<% end %>
<% end %>
</dl>
</div>
<% end %>
<%= javascript_tag do %>
function selectTracker(id) {
var target = $('#issue_tracker_id');
target.attr("selected", false);
target.find('option[value="' + id + '"]').prop('selected', true);
target.trigger('change');
hideModal('#trackers_description h3');
}
<% end %>
test/ui/issues_test_ui.rb
# check issue attributes
assert_equal 'jsmith', issue.author.login
assert_equal 1, issue.project.id
assert_equal IssueStatus.find_by_name('New'), issue.status
assert_equal IssueStatus.find_by_name('New'), issue.status
assert_equal Tracker.find_by_name('Bug'), issue.tracker
assert_equal IssuePriority.find_by_name('Low'), issue.priority
assert_equal 'Value for field 2', issue.custom_field_value(CustomField.find_by_name('Searchable field'))
......
# Check that the page shows the Estimated hours total
assert page.has_css?('p.query-totals')
assert page.has_css?('span.total-for-estimated-hours')
# Open the Options of the form (necessary for having the totalable columns options clickable)
# Open the Options of the form (necessary for having the totalable columns options clickable)
page.all('legend')[1].click
# Deselect the default totalable column (none should be left)
# Deselect the default totalable column (none should be left)
page.first('input[name="t[]"][value="estimated_hours"]').click
within('#query_form') do
click_link 'Apply'
......
sleep 1
assert_equal 'Updated notes', Journal.find(2).notes
end
def test_issue_trackers_description_should_select_tracker
log_user('admin', 'admin')
visit '/issues/1'
page.first(:link, 'Edit').click
page.click_link('View all trackers description')
assert page.has_css?('#trackers_description')
within('#trackers_description') do
click_link('Feature')
end
assert !page.has_css?('#trackers_description')
assert_equal "2", page.find('select#issue_tracker_id').value
end
end
(2-2/7)