summaryrefslogtreecommitdiff
path: root/spec/features/projects/wiki
diff options
context:
space:
mode:
authorBrett Walker <bwalker@gitlab.com>2018-09-02 10:24:27 -0500
committerBrett Walker <bwalker@gitlab.com>2018-09-05 09:19:16 -0500
commita963721f797b451efec15702e73752c8b8830631 (patch)
tree46b920a9b5fd0078d5cfdcdecb8e5c16be852f21 /spec/features/projects/wiki
parente41b99943230240403bdca7b19d5f379892cd819 (diff)
downloadgitlab-ce-a963721f797b451efec15702e73752c8b8830631.tar.gz
render using RedCarpet if legacy_render parameter is set
Diffstat (limited to 'spec/features/projects/wiki')
-rw-r--r--spec/features/projects/wiki/markdown_preview_spec.rb28
1 files changed, 28 insertions, 0 deletions
diff --git a/spec/features/projects/wiki/markdown_preview_spec.rb b/spec/features/projects/wiki/markdown_preview_spec.rb
index ed5f8105487..f505023d1d0 100644
--- a/spec/features/projects/wiki/markdown_preview_spec.rb
+++ b/spec/features/projects/wiki/markdown_preview_spec.rb
@@ -162,6 +162,34 @@ describe 'Projects > Wiki > User previews markdown changes', :js do
expect(page.html).to include("<a href=\"/#{project.full_path}/wikis/title%20with%20spaces\">spaced link</a>")
end
end
+
+ context 'when rendering the preview' do
+ it 'renders content with CommonMark' do
+ create_wiki_page 'a-page/b-page/c-page/common-mark'
+ click_link 'Edit'
+
+ fill_in :wiki_content, with: "1. one\n - sublist\n"
+ click_on "Preview"
+
+ # the above generates two seperate lists (not embedded) in CommonMark
+ expect(page).to have_content("sublist")
+ expect(page).not_to have_xpath("//ol//li//ul")
+ end
+
+ it 'renders content with RedCarpet when legacy_render is set' do
+ wiki_page = create(:wiki_page,
+ wiki: project.wiki,
+ attrs: { title: 'home', content: "Empty content" })
+ visit(project_wiki_edit_path(project, wiki_page, legacy_render: 1))
+
+ fill_in :wiki_content, with: "1. one\n - sublist\n"
+ click_on "Preview"
+
+ # the above generates a sublist list in RedCarpet
+ expect(page).to have_content("sublist")
+ expect(page).to have_xpath("//ol//li//ul")
+ end
+ end
end
it "does not linkify double brackets inside code blocks as expected" do