diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-02-06 02:38:37 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2014-02-06 02:38:37 +0000 |
commit | e4d152e84a0f77fa0484d16c86022097ff31e2fb (patch) | |
tree | 982b96e3cece49800dba201f476acf535951ec67 /test | |
parent | b6668e3ebf88db93bd0e9d9806f1830d95e35744 (diff) | |
download | redmine-e4d152e84a0f77fa0484d16c86022097ff31e2fb.tar.gz redmine-e4d152e84a0f77fa0484d16c86022097ff31e2fb.zip |
add tests of ApplicationHelper#link_to_issue subject and title
git-svn-id: http://svn.redmine.org/redmine/trunk@12829 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/helpers/application_helper_test.rb | 35 |
1 files changed, 35 insertions, 0 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb index e640de0c7..596bfd7fb 100644 --- a/test/unit/helpers/application_helper_test.rb +++ b/test/unit/helpers/application_helper_test.rb @@ -436,6 +436,41 @@ RAW end end + def test_link_to_issue_subject + issue = Issue.generate!(:subject => "01234567890123456789") + str = link_to_issue(issue, :truncate => 10) + result = link_to("Bug ##{issue.id}", "/issues/#{issue.id}", :class => issue.css_classes) + assert_equal "#{result}: 0123456...", str + + issue = Issue.generate!(:subject => "<&>") + str = link_to_issue(issue) + result = link_to("Bug ##{issue.id}", "/issues/#{issue.id}", :class => issue.css_classes) + assert_equal "#{result}: <&>", str + + issue = Issue.generate!(:subject => "<&>0123456789012345") + str = link_to_issue(issue, :truncate => 10) + result = link_to("Bug ##{issue.id}", "/issues/#{issue.id}", :class => issue.css_classes) + assert_equal "#{result}: <&>0123...", str + end + + def test_link_to_issue_title + long_str = "0123456789" * 5 + + issue = Issue.generate!(:subject => "#{long_str}01234567890123456789") + str = link_to_issue(issue, :subject => false) + result = link_to("Bug ##{issue.id}", "/issues/#{issue.id}", + :class => issue.css_classes, + :title => "#{long_str}0123456...") + assert_equal result, str + + issue = Issue.generate!(:subject => "<&>#{long_str}01234567890123456789") + str = link_to_issue(issue, :subject => false) + result = link_to("Bug ##{issue.id}", "/issues/#{issue.id}", + :class => issue.css_classes, + :title => "<&>#{long_str}0123...") + assert_equal result, str + end + def test_multiple_repositories_redmine_links svn = Repository::Subversion.create!(:project_id => 1, :identifier => 'svn_repo-1', :url => 'file:///foo/hg') Changeset.create!(:repository => svn, :committed_on => Time.now, :revision => '123') |