Fix missing tests from release/7.4 merge

They got split up in textile and markdown spec and got removed.

[ci skip]
pull/6302/head
Oliver Günther 7 years ago
commit baaa61a4a0
No known key found for this signature in database
GPG Key ID: 88872239EB414F99
  1. 23
      lib/open_project/text_formatting/formatters/textile/formatter.rb
  2. 6
      spec/lib/open_project/text_formatting/markdown/markdown_spec.rb

@ -257,17 +257,22 @@ module OpenProject::TextFormatting::Formatters
page = CGI.unescapeHTML(page)
# check if page exists
wiki_page = link_project.wiki.find_page(page)
wiki_title = wiki_page.nil? ? page : wiki_page.title
default_wiki_title = wiki_page.nil? ? page : wiki_page.title
wiki_title = title || default_wiki_title
url = case options[:wiki_links]
when :local;
"#{title}.html"
when :anchor;
"##{title}" # used for single-file wiki export
else
wiki_page_id = wiki_page.nil? ? page.to_url : wiki_page.slug
url_for(only_path: only_path, controller: '/wiki', action: 'show', project_id: link_project, id: wiki_page_id, anchor: anchor)
when :local; "#{title}.html"
when :anchor; "##{title}" # used for single-file wiki export
else
wiki_page_id = wiki_page.nil? ? page.to_url : wiki_page.slug
url_for(only_path: only_path,
controller: '/wiki',
action: 'show',
project_id: link_project,
id: wiki_page_id,
title: wiki_page.nil? ? wiki_title.strip : nil,
anchor: anchor)
end
link_to(h(title || wiki_title), url, class: ('wiki-page' + (wiki_page ? '' : ' new')))
link_to(h(wiki_title), url, class: ('wiki-page' + (wiki_page ? '' : ' new')))
else
# project or wiki doesn't exist
all

@ -486,13 +486,13 @@ describe OpenProject::TextFormatting,
context 'Wiki link to an unknown page' do
subject { format_text('[[Unknown page]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/#{project.identifier}/wiki/unknown-page\">Unknown page</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/#{project.identifier}/wiki/unknown-page?title=Unknown+page\">Unknown page</a></p>") }
end
context 'Wiki page link to an unknown page' do
subject { format_text('[[Unknown page|404]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/#{project.identifier}/wiki/unknown-page\">404</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/#{project.identifier}/wiki/unknown-page?title=404\">404</a></p>") }
end
context "Link to another project's wiki" do
@ -522,7 +522,7 @@ describe OpenProject::TextFormatting,
context 'Link to an unknown wiki page in another project' do
subject { format_text('[[onlinestore:Unknown page]]') }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/onlinestore/wiki/unknown-page\">Unknown page</a></p>") }
it { is_expected.to be_html_eql("<p><a class=\"wiki-page new\" href=\"/projects/onlinestore/wiki/unknown-page?title=Unknown+page\">Unknown page</a></p>") }
end
context 'Struck through link to wiki page' do

Loading…
Cancel
Save