mirror of
https://github.com/redmine/redmine.git
synced 2026-02-20 13:37:39 +01:00
Fixes Wiki "Edit this section" does not extract SeText headings correctly in CommonMark Markdown (#40918).
git-svn-id: https://svn.redmine.org/redmine/trunk@24434 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
@@ -403,6 +403,39 @@ class WikiControllerTest < Redmine::ControllerTest
|
||||
end
|
||||
end
|
||||
|
||||
def test_edit_section_with_common_mark_should_correctly_extract_setext_heading
|
||||
text = <<~STR
|
||||
A new MarkDown page
|
||||
===================
|
||||
This text is the first section.
|
||||
|
||||
First subsection
|
||||
----------------
|
||||
Here would be a first subsection
|
||||
|
||||
Second subsection
|
||||
-----------------
|
||||
Here would be a second subsection
|
||||
STR
|
||||
|
||||
page = WikiPage.find_by_title('Page_with_sections')
|
||||
page.content.text = text
|
||||
page.content.save!
|
||||
|
||||
with_settings :text_formatting => 'common_mark' do
|
||||
@request.session[:user_id] = 2
|
||||
get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 2}
|
||||
|
||||
assert_response :success
|
||||
|
||||
section, hash = Redmine::WikiFormatting::CommonMark::Formatter.new(page.content.text).get_section(2)
|
||||
|
||||
assert_select 'textarea[name=?]', 'content[text]', :text => section
|
||||
assert_select 'input[name=section][type=hidden][value="2"]'
|
||||
assert_select 'input[name=section_hash][type=hidden][value=?]', hash
|
||||
end
|
||||
end
|
||||
|
||||
def test_edit_invalid_section_should_respond_with_404
|
||||
@request.session[:user_id] = 2
|
||||
get :edit, :params => {:project_id => 'ecookbook', :id => 'Page_with_sections', :section => 10}
|
||||
|
||||
Reference in New Issue
Block a user