@@ -706,23 +706,46 RAW | |||||
706 | end |
|
706 | end | |
707 |
|
707 | |||
708 | def test_wiki_links_anchor_option_should_prepend_page_title_to_href |
|
708 | def test_wiki_links_anchor_option_should_prepend_page_title_to_href | |
709 |
|
||||
710 | to_test = { |
|
709 | to_test = { | |
711 | # link to a page |
|
710 | # link to a page | |
712 | '[[CookBook documentation]]' => '<a href="#CookBook_documentation" class="wiki-page">CookBook documentation</a>', |
|
711 | '[[CookBook documentation]]' => | |
713 | '[[CookBook documentation|documentation]]' => '<a href="#CookBook_documentation" class="wiki-page">documentation</a>', |
|
712 | link_to("CookBook documentation", | |
714 | '[[CookBook documentation#One-section]]' => '<a href="#CookBook_documentation_One-section" class="wiki-page">CookBook documentation</a>', |
|
713 | "#CookBook_documentation", | |
715 | '[[CookBook documentation#One-section|documentation]]' => '<a href="#CookBook_documentation_One-section" class="wiki-page">documentation</a>', |
|
714 | :class => "wiki-page"), | |
|
715 | '[[CookBook documentation|documentation]]' => | |||
|
716 | link_to("documentation", | |||
|
717 | "#CookBook_documentation", | |||
|
718 | :class => "wiki-page"), | |||
|
719 | '[[CookBook documentation#One-section]]' => | |||
|
720 | link_to("CookBook documentation", | |||
|
721 | "#CookBook_documentation_One-section", | |||
|
722 | :class => "wiki-page"), | |||
|
723 | '[[CookBook documentation#One-section|documentation]]' => | |||
|
724 | link_to("documentation", | |||
|
725 | "#CookBook_documentation_One-section", | |||
|
726 | :class => "wiki-page"), | |||
716 | # page that doesn't exist |
|
727 | # page that doesn't exist | |
717 | '[[Unknown page]]' => '<a href="#Unknown_page" class="wiki-page new">Unknown page</a>', |
|
728 | '[[Unknown page]]' => | |
718 | '[[Unknown page|404]]' => '<a href="#Unknown_page" class="wiki-page new">404</a>', |
|
729 | link_to("Unknown page", | |
719 | '[[Unknown page#anchor]]' => '<a href="#Unknown_page_anchor" class="wiki-page new">Unknown page</a>', |
|
730 | "#Unknown_page", | |
720 | '[[Unknown page#anchor|404]]' => '<a href="#Unknown_page_anchor" class="wiki-page new">404</a>', |
|
731 | :class => "wiki-page new"), | |
|
732 | '[[Unknown page|404]]' => | |||
|
733 | link_to("404", | |||
|
734 | "#Unknown_page", | |||
|
735 | :class => "wiki-page new"), | |||
|
736 | '[[Unknown page#anchor]]' => | |||
|
737 | link_to("Unknown page", | |||
|
738 | "#Unknown_page_anchor", | |||
|
739 | :class => "wiki-page new"), | |||
|
740 | '[[Unknown page#anchor|404]]' => | |||
|
741 | link_to("404", | |||
|
742 | "#Unknown_page_anchor", | |||
|
743 | :class => "wiki-page new"), | |||
721 | } |
|
744 | } | |
722 |
|
||||
723 | @project = Project.find(1) |
|
745 | @project = Project.find(1) | |
724 |
|
746 | to_test.each do |text, result| | ||
725 |
|
|
747 | assert_equal "<p>#{result}</p>", textilizable(text, :wiki_links => :anchor) | |
|
748 | end | |||
726 | end |
|
749 | end | |
727 |
|
750 | |||
728 | def test_html_tags |
|
751 | def test_html_tags |
General Comments 0
You need to be logged in to leave comments.
Login now