Skip to content

Commit

Permalink
Ne pas appliquer le filtre par tracker dans la page template/index s'…
Browse files Browse the repository at this point in the history
…ils sont tous sélectionnés
  • Loading branch information
Yalaeddin authored and nanego committed Apr 19, 2024
1 parent 7630bf6 commit e417d75
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
1 change: 1 addition & 0 deletions app/views/issue_templates/_filters.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
</div>
</label>
<% end %>
<%= check_box_tag 'tracker_ids[]', 0, 1, :id => nil, :style => 'display:none;' %>
</fieldset>
<% end %>

Expand Down
2 changes: 1 addition & 1 deletion app/views/issue_templates/_list_template.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
%>

<tr class="issue_template issue"
data-tracker-id="<%= issue_template.tracker_id %>"
data-tracker-id="<%= (issue_template.tracker_id.present? ? issue_template.tracker_id : 0) %>"
data-template-id="<%= issue_template.id %>"
data-template-enabled="<%= issue_template.template_enabled? ? '1' : '0' %>">
<% link_to_edition = Proc.new do |label, title|
Expand Down
23 changes: 22 additions & 1 deletion spec/system/issue_templates_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -146,5 +146,26 @@ def find_closest_label(labels ,target_element)
end
end
end


describe "Template index" do

before do
log_user('admin', 'admin')
end

it "Should not apply the filter by tracker if all trackers are selected" do
# Removing a tracker to simulate the absence of a tracker
tracker_to_remove = Tracker.find(3)
tracker_to_remove.destroy

# Retrieving the issue template without a tracker
template_without_tracker = IssueTemplate.last

# Verifying that the issue template has a tracker_id equal to 0
expect(template_without_tracker.tracker_id).to eq(0)

visit "/issue_templates"
expect(page.body).to have_selector("a", text: "#{template_without_tracker.template_title}")
end
end
end

0 comments on commit e417d75

Please sign in to comment.