summaryrefslogtreecommitdiffstats
path: root/test/unit
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-14 08:09:23 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-02-14 08:09:23 +0000
commit4ccb8983606fbb1a5fcfd242fd15aa6275a42aaf (patch)
treeca8934ac43a0f035a85a5e159f1f45cb24069ed7 /test/unit
parentad668f42775caf243eaa8124210e8f4377f071ef (diff)
downloadredmine-4ccb8983606fbb1a5fcfd242fd15aa6275a42aaf.tar.gz
redmine-4ccb8983606fbb1a5fcfd242fd15aa6275a42aaf.zip
Fixed: {{toc}} uses identical anchors for subsections with the same name (#8194).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8871 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit')
-rw-r--r--test/unit/helpers/application_helper_test.rb27
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unit/helpers/application_helper_test.rb b/test/unit/helpers/application_helper_test.rb
index a8652b3f9..7024f6fa0 100644
--- a/test/unit/helpers/application_helper_test.rb
+++ b/test/unit/helpers/application_helper_test.rb
@@ -837,6 +837,33 @@ RAW
assert textilizable(raw).gsub("\n", "").include?(expected)
end
+ def test_table_of_content_should_generate_unique_anchors
+ raw = <<-RAW
+{{toc}}
+
+h1. Title
+
+h2. Subtitle
+
+h2. Subtitle
+RAW
+
+ expected = '<ul class="toc">' +
+ '<li><a href="#Title">Title</a>' +
+ '<ul>' +
+ '<li><a href="#Subtitle">Subtitle</a></li>' +
+ '<li><a href="#Subtitle-2">Subtitle</a></li>'
+ '</ul>'
+ '</li>' +
+ '</ul>'
+
+ @project = Project.find(1)
+ result = textilizable(raw).gsub("\n", "")
+ assert_include expected, result
+ assert_include '<a name="Subtitle">', result
+ assert_include '<a name="Subtitle-2">', result
+ end
+
def test_table_of_content_should_contain_included_page_headings
raw = <<-RAW
{{toc}}