summaryrefslogtreecommitdiffstats
path: root/test/helpers
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-08-23 12:59:48 +0000
committerGo MAEDA <maeda@farend.jp>2021-08-23 12:59:48 +0000
commitd276dca5c5a397d2e69286d80a27d82998eedf55 (patch)
tree970cbfec41c638bdcd2a830e8d2a81fb77ec1847 /test/helpers
parentfc03ef428238ebafe0d10558a01eb6ae7ebd54c3 (diff)
downloadredmine-d276dca5c5a397d2e69286d80a27d82998eedf55.tar.gz
redmine-d276dca5c5a397d2e69286d80a27d82998eedf55.zip
Query links for related issues on issue page (#35559).
Patch by Takenori TAKAKI. git-svn-id: http://svn.redmine.org/redmine/trunk@21200 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/helpers')
-rw-r--r--test/helpers/issues_helper_test.rb38
1 files changed, 38 insertions, 0 deletions
diff --git a/test/helpers/issues_helper_test.rb b/test/helpers/issues_helper_test.rb
index 28a520b3e..0b3325ad7 100644
--- a/test/helpers/issues_helper_test.rb
+++ b/test/helpers/issues_helper_test.rb
@@ -397,4 +397,42 @@ class IssuesHelperTest < Redmine::HelperTest
end
end
end
+
+ def test_render_issues_stats
+ html = render_issues_stats(1, 1, {:issue_id => '15,16'})
+
+ assert_include '<a href="/issues?issue_id=15%2C16&amp;set_filter=true&amp;status_id=%2A">2</a>', html
+ assert_include '<a href="/issues?issue_id=15%2C16&amp;set_filter=true&amp;status_id=o">1 open</a>', html
+ assert_include '<a href="/issues?issue_id=15%2C16&amp;set_filter=true&amp;status_id=c">1 closed</a>', html
+ end
+
+ def test_render_descendants_stats
+ parent = Issue.generate!(:status_id => 1)
+ child = Issue.generate!(:parent_issue_id => parent.id, :status_id => 1)
+ Issue.generate!(:parent_issue_id => child.id, :status_id => 5)
+ parent.reload
+ html = render_descendants_stats(parent)
+
+ assert_include "<a href=\"/issues?parent_id=~#{parent.id}&amp;set_filter=true&amp;status_id=%2A\">2</a>", html
+ assert_include "<a href=\"/issues?parent_id=~#{parent.id}&amp;set_filter=true&amp;status_id=o\">1 open</a>", html
+ assert_include "<a href=\"/issues?parent_id=~#{parent.id}&amp;set_filter=true&amp;status_id=c\">1 closed</a>", html
+ end
+
+ def test_render_relations_stats
+ issue = Issue.generate!(:status_id => 1)
+ relations = []
+ open_issue = Issue.generate!(:status_id => 1)
+ relations << IssueRelation.create!(:issue_from => open_issue,
+ :issue_to => issue,
+ :relation_type => IssueRelation::TYPE_RELATES)
+ closed_issue = Issue.generate!(:status_id => 5)
+ relations << IssueRelation.create!(:issue_from => closed_issue,
+ :issue_to => issue,
+ :relation_type => IssueRelation::TYPE_FOLLOWS)
+ html = render_relations_stats(issue, relations)
+
+ assert_include "<a href=\"/issues?issue_id=#{open_issue.id}%2C#{closed_issue.id}&amp;set_filter=true&amp;status_id=%2A\">2</a></span>", html
+ assert_include "<a href=\"/issues?issue_id=#{open_issue.id}%2C#{closed_issue.id}&amp;set_filter=true&amp;status_id=o\">1 open</a>", html
+ assert_include "<a href=\"/issues?issue_id=#{open_issue.id}%2C#{closed_issue.id}&amp;set_filter=true&amp;status_id=c\">1 closed</a>", html
+ end
end