@@ -644,36 +644,86 RAW | |||||
644 | def test_wiki_links |
|
644 | def test_wiki_links | |
645 | russian_eacape = CGI.escape(@russian_test) |
|
645 | russian_eacape = CGI.escape(@russian_test) | |
646 | to_test = { |
|
646 | to_test = { | |
647 | '[[CookBook documentation]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation" class="wiki-page">CookBook documentation</a>', |
|
647 | '[[CookBook documentation]]' => | |
648 | '[[Another page|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a>', |
|
648 | link_to("CookBook documentation", | |
|
649 | "/projects/ecookbook/wiki/CookBook_documentation", | |||
|
650 | :class => "wiki-page"), | |||
|
651 | '[[Another page|Page]]' => | |||
|
652 | link_to("Page", | |||
|
653 | "/projects/ecookbook/wiki/Another_page", | |||
|
654 | :class => "wiki-page"), | |||
649 | # title content should be formatted |
|
655 | # title content should be formatted | |
650 | '[[Another page|With _styled_ *title*]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">With <em>styled</em> <strong>title</strong></a>', |
|
656 | '[[Another page|With _styled_ *title*]]' => | |
651 | '[[Another page|With title containing <strong>HTML entities & markups</strong>]]' => '<a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">With title containing <strong>HTML entities & markups</strong></a>', |
|
657 | link_to("With <em>styled</em> <strong>title</strong>".html_safe, | |
|
658 | "/projects/ecookbook/wiki/Another_page", | |||
|
659 | :class => "wiki-page"), | |||
|
660 | '[[Another page|With title containing <strong>HTML entities & markups</strong>]]' => | |||
|
661 | link_to("With title containing <strong>HTML entities & markups</strong>".html_safe, | |||
|
662 | "/projects/ecookbook/wiki/Another_page", | |||
|
663 | :class => "wiki-page"), | |||
652 | # link with anchor |
|
664 | # link with anchor | |
653 | '[[CookBook documentation#One-section]]' => '<a href="/projects/ecookbook/wiki/CookBook_documentation#One-section" class="wiki-page">CookBook documentation</a>', |
|
665 | '[[CookBook documentation#One-section]]' => | |
654 | '[[Another page#anchor|Page]]' => '<a href="/projects/ecookbook/wiki/Another_page#anchor" class="wiki-page">Page</a>', |
|
666 | link_to("CookBook documentation", | |
|
667 | "/projects/ecookbook/wiki/CookBook_documentation#One-section", | |||
|
668 | :class => "wiki-page"), | |||
|
669 | '[[Another page#anchor|Page]]' => | |||
|
670 | link_to("Page", | |||
|
671 | "/projects/ecookbook/wiki/Another_page#anchor", | |||
|
672 | :class => "wiki-page"), | |||
655 | # UTF8 anchor |
|
673 | # UTF8 anchor | |
656 | "[[Another_page##{@russian_test}|#{@russian_test}]]" => |
|
674 | "[[Another_page##{@russian_test}|#{@russian_test}]]" => | |
657 | %|<a href="/projects/ecookbook/wiki/Another_page##{russian_eacape}" class="wiki-page">#{@russian_test}</a>|, |
|
675 | link_to(@russian_test, | |
|
676 | "/projects/ecookbook/wiki/Another_page##{russian_eacape}", | |||
|
677 | :class => "wiki-page"), | |||
658 | # page that doesn't exist |
|
678 | # page that doesn't exist | |
659 | '[[Unknown page]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">Unknown page</a>', |
|
679 | '[[Unknown page]]' => | |
660 | '[[Unknown page|404]]' => '<a href="/projects/ecookbook/wiki/Unknown_page" class="wiki-page new">404</a>', |
|
680 | link_to("Unknown page", | |
|
681 | "/projects/ecookbook/wiki/Unknown_page", | |||
|
682 | :class => "wiki-page new"), | |||
|
683 | '[[Unknown page|404]]' => | |||
|
684 | link_to("404", | |||
|
685 | "/projects/ecookbook/wiki/Unknown_page", | |||
|
686 | :class => "wiki-page new"), | |||
661 | # link to another project wiki |
|
687 | # link to another project wiki | |
662 | '[[onlinestore:]]' => '<a href="/projects/onlinestore/wiki" class="wiki-page">onlinestore</a>', |
|
688 | '[[onlinestore:]]' => | |
663 | '[[onlinestore:|Wiki]]' => '<a href="/projects/onlinestore/wiki" class="wiki-page">Wiki</a>', |
|
689 | link_to("onlinestore", | |
664 | '[[onlinestore:Start page]]' => '<a href="/projects/onlinestore/wiki/Start_page" class="wiki-page">Start page</a>', |
|
690 | "/projects/onlinestore/wiki", | |
665 | '[[onlinestore:Start page|Text]]' => '<a href="/projects/onlinestore/wiki/Start_page" class="wiki-page">Text</a>', |
|
691 | :class => "wiki-page"), | |
666 | '[[onlinestore:Unknown page]]' => '<a href="/projects/onlinestore/wiki/Unknown_page" class="wiki-page new">Unknown page</a>', |
|
692 | '[[onlinestore:|Wiki]]' => | |
|
693 | link_to("Wiki", | |||
|
694 | "/projects/onlinestore/wiki", | |||
|
695 | :class => "wiki-page"), | |||
|
696 | '[[onlinestore:Start page]]' => | |||
|
697 | link_to("Start page", | |||
|
698 | "/projects/onlinestore/wiki/Start_page", | |||
|
699 | :class => "wiki-page"), | |||
|
700 | '[[onlinestore:Start page|Text]]' => | |||
|
701 | link_to("Text", | |||
|
702 | "/projects/onlinestore/wiki/Start_page", | |||
|
703 | :class => "wiki-page"), | |||
|
704 | '[[onlinestore:Unknown page]]' => | |||
|
705 | link_to("Unknown page", | |||
|
706 | "/projects/onlinestore/wiki/Unknown_page", | |||
|
707 | :class => "wiki-page new"), | |||
667 | # striked through link |
|
708 | # striked through link | |
668 | '-[[Another page|Page]]-' => '<del><a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a></del>', |
|
709 | '-[[Another page|Page]]-' => | |
669 | '-[[Another page|Page]] link-' => '<del><a href="/projects/ecookbook/wiki/Another_page" class="wiki-page">Page</a> link</del>', |
|
710 | "<del>".html_safe + | |
|
711 | link_to("Page", | |||
|
712 | "/projects/ecookbook/wiki/Another_page", | |||
|
713 | :class => "wiki-page").html_safe + | |||
|
714 | "</del>".html_safe, | |||
|
715 | '-[[Another page|Page]] link-' => | |||
|
716 | "<del>".html_safe + | |||
|
717 | link_to("Page", | |||
|
718 | "/projects/ecookbook/wiki/Another_page", | |||
|
719 | :class => "wiki-page").html_safe + | |||
|
720 | " link</del>".html_safe, | |||
670 | # escaping |
|
721 | # escaping | |
671 | '![[Another page|Page]]' => '[[Another page|Page]]', |
|
722 | '![[Another page|Page]]' => '[[Another page|Page]]', | |
672 | # project does not exist |
|
723 | # project does not exist | |
673 | '[[unknowproject:Start]]' => '[[unknowproject:Start]]', |
|
724 | '[[unknowproject:Start]]' => '[[unknowproject:Start]]', | |
674 | '[[unknowproject:Start|Page title]]' => '[[unknowproject:Start|Page title]]', |
|
725 | '[[unknowproject:Start|Page title]]' => '[[unknowproject:Start|Page title]]', | |
675 | } |
|
726 | } | |
676 |
|
||||
677 | @project = Project.find(1) |
|
727 | @project = Project.find(1) | |
678 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } |
|
728 | to_test.each { |text, result| assert_equal "<p>#{result}</p>", textilizable(text) } | |
679 | end |
|
729 | end |
General Comments 0
You need to be logged in to leave comments.
Login now