summaryrefslogtreecommitdiff
path: root/spec/features
diff options
context:
space:
mode:
authorMartin Hanzel <mhanzel@gitlab.com>2019-07-16 07:09:55 +0000
committerKushal Pandya <kushalspandya@gmail.com>2019-07-16 07:09:55 +0000
commitd50f41d0f2103f78039ef4d01eda5d30ff968d6e (patch)
treeae61802eccfee6d3e2e6a619bf4b774a430428e9 /spec/features
parent38aa79de0623cd197769adea9a22ae6762a3b638 (diff)
downloadgitlab-ce-d50f41d0f2103f78039ef4d01eda5d30ff968d6e.tar.gz
Fix linebreak rendering in Mermaid flowcharts
Diffstat (limited to 'spec/features')
-rw-r--r--spec/features/markdown/mermaid_spec.rb18
1 files changed, 18 insertions, 0 deletions
diff --git a/spec/features/markdown/mermaid_spec.rb b/spec/features/markdown/mermaid_spec.rb
index 7008b361394..e3bcaca737e 100644
--- a/spec/features/markdown/mermaid_spec.rb
+++ b/spec/features/markdown/mermaid_spec.rb
@@ -21,4 +21,22 @@ describe 'Mermaid rendering', :js do
expect(page).to have_selector('svg text', text: label)
end
end
+
+ it 'renders linebreaks in Mermaid diagrams' do
+ description = <<~MERMAID
+ ```mermaid
+ graph TD;
+ A(Line 1<br>Line 2)-->B(Line 1<br/>Line 2);
+ C(Line 1<br />Line 2)-->D(Line 1<br />Line 2);
+ ```
+ MERMAID
+
+ project = create(:project, :public)
+ issue = create(:issue, project: project, description: description)
+
+ visit project_issue_path(project, issue)
+
+ expected = '<text><tspan xml:space="preserve" dy="1em" x="1">Line 1</tspan><tspan xml:space="preserve" dy="1em" x="1">Line 2</tspan></text>'
+ expect(page.html.scan(expected).count).to be(4)
+ end
end