Mercurial > hg > soundsoftware-site
comparison test/unit/lib/redmine/wiki_formatting/macros_test.rb @ 1517:dffacf8a6908 redmine-2.5
Update to Redmine SVN revision 13367 on 2.5-stable branch
author | Chris Cannam |
---|---|
date | Tue, 09 Sep 2014 09:29:00 +0100 |
parents | e248c7af89ec |
children |
comparison
equal
deleted
inserted
replaced
1516:b450a9d58aed | 1517:dffacf8a6908 |
---|---|
233 assert_select_in result, 'strong', :text => 'Collapsed' | 233 assert_select_in result, 'strong', :text => 'Collapsed' |
234 assert_select_in result, 'a.collapsible.collapsed', :text => 'Show example' | 234 assert_select_in result, 'a.collapsible.collapsed', :text => 'Show example' |
235 assert_select_in result, 'a.collapsible', :text => 'Hide example' | 235 assert_select_in result, 'a.collapsible', :text => 'Hide example' |
236 end | 236 end |
237 | 237 |
238 def test_macro_collapse_should_not_break_toc | |
239 text = <<-RAW | |
240 {{toc}} | |
241 | |
242 h1. Title | |
243 | |
244 {{collapse(Show example, Hide example) | |
245 h2. Heading | |
246 }}" | |
247 RAW | |
248 | |
249 expected_toc = '<ul class="toc"><li><a href="#Title">Title</a><ul><li><a href="#Heading">Heading</a></li></ul></li></ul>' | |
250 | |
251 assert_include expected_toc, textilizable(text).gsub(/[\r\n]/, '') | |
252 end | |
253 | |
238 def test_macro_child_pages | 254 def test_macro_child_pages |
239 expected = "<p><ul class=\"pages-hierarchy\">\n" + | 255 expected = "<p><ul class=\"pages-hierarchy\">\n" + |
240 "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a>\n" + | 256 "<li><a href=\"/projects/ecookbook/wiki/Child_1\">Child 1</a>\n" + |
241 "<ul class=\"pages-hierarchy\">\n<li><a href=\"/projects/ecookbook/wiki/Child_1_1\">Child 1 1</a></li>\n</ul>\n</li>\n" + | 257 "<ul class=\"pages-hierarchy\">\n<li><a href=\"/projects/ecookbook/wiki/Child_1_1\">Child 1 1</a></li>\n</ul>\n</li>\n" + |
242 "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" + | 258 "<li><a href=\"/projects/ecookbook/wiki/Child_2\">Child 2</a></li>\n" + |
284 def test_macro_child_pages_without_wiki_page_should_fail | 300 def test_macro_child_pages_without_wiki_page_should_fail |
285 assert_match /can be called from wiki pages only/, textilizable("{{child_pages}}") | 301 assert_match /can be called from wiki pages only/, textilizable("{{child_pages}}") |
286 end | 302 end |
287 | 303 |
288 def test_macro_thumbnail | 304 def test_macro_thumbnail |
289 assert_equal '<p><a href="/attachments/17" class="thumbnail" title="testfile.PNG"><img alt="testfile.PNG" src="/attachments/thumbnail/17" /></a></p>', | 305 link = link_to('<img alt="testfile.PNG" src="http://test.host/attachments/thumbnail/17" />'.html_safe, |
290 textilizable("{{thumbnail(testfile.png)}}", :object => Issue.find(14)) | 306 "http://test.host/attachments/17", |
307 :class => "thumbnail", | |
308 :title => "testfile.PNG") | |
309 assert_equal "<p>#{link}</p>", | |
310 textilizable("{{thumbnail(testfile.png)}}", :object => Issue.find(14)) | |
291 end | 311 end |
292 | 312 |
293 def test_macro_thumbnail_with_size | 313 def test_macro_thumbnail_with_size |
294 assert_equal '<p><a href="/attachments/17" class="thumbnail" title="testfile.PNG"><img alt="testfile.PNG" src="/attachments/thumbnail/17/200" /></a></p>', | 314 link = link_to('<img alt="testfile.PNG" src="http://test.host/attachments/thumbnail/17/200" />'.html_safe, |
295 textilizable("{{thumbnail(testfile.png, size=200)}}", :object => Issue.find(14)) | 315 "http://test.host/attachments/17", |
316 :class => "thumbnail", | |
317 :title => "testfile.PNG") | |
318 assert_equal "<p>#{link}</p>", | |
319 textilizable("{{thumbnail(testfile.png, size=200)}}", :object => Issue.find(14)) | |
296 end | 320 end |
297 | 321 |
298 def test_macro_thumbnail_with_title | 322 def test_macro_thumbnail_with_title |
299 assert_equal '<p><a href="/attachments/17" class="thumbnail" title="Cool image"><img alt="testfile.PNG" src="/attachments/thumbnail/17" /></a></p>', | 323 link = link_to('<img alt="testfile.PNG" src="http://test.host/attachments/thumbnail/17" />'.html_safe, |
300 textilizable("{{thumbnail(testfile.png, title=Cool image)}}", :object => Issue.find(14)) | 324 "http://test.host/attachments/17", |
325 :class => "thumbnail", | |
326 :title => "Cool image") | |
327 assert_equal "<p>#{link}</p>", | |
328 textilizable("{{thumbnail(testfile.png, title=Cool image)}}", :object => Issue.find(14)) | |
301 end | 329 end |
302 | 330 |
303 def test_macro_thumbnail_with_invalid_filename_should_fail | 331 def test_macro_thumbnail_with_invalid_filename_should_fail |
304 assert_include 'test.png not found', | 332 assert_include 'test.png not found', |
305 textilizable("{{thumbnail(test.png)}}", :object => Issue.find(14)) | 333 textilizable("{{thumbnail(test.png)}}", :object => Issue.find(14)) |