out = ''.html_safe
out << link_to_function(show_label, js, :id => "#{html_id}-show", :class => 'collapsible collapsed')
out << link_to_function(hide_label, js, :id => "#{html_id}-hide", :class => 'collapsible', :style => 'display:none;')
- out << content_tag('div', textilizable(text, :object => obj), :id => html_id, :class => 'collapsed-text', :style => 'display:none;')
+ out << content_tag('div', textilizable(text, :object => obj, :headings => false), :id => html_id, :class => 'collapsed-text', :style => 'display:none;')
out
end
assert_select_in result, 'a.collapsible', :text => 'Hide example'
end
+ def test_macro_collapse_should_not_break_toc
+ text = <<-RAW
+{{toc}}
+
+h1. Title
+
+{{collapse(Show example, Hide example)
+h2. Heading
+}}"
+RAW
+
+ expected_toc = '<ul class="toc"><li><a href="#Title">Title</a><ul><li><a href="#Heading">Heading</a></li></ul></li></ul>'
+
+ assert_include expected_toc, textilizable(text).gsub(/[\r\n]/, '')
+ end
+
def test_macro_child_pages
expected = "<p><ul class=\"pages-hierarchy\">\n" +
"<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a>\n" +