gitlab-org--gitlab-foss/spec/features/markdown/mermaid_spec.rb
Cindy Pallares c4bb0a116e
Merge branch 'security-mermaid-xss' into 'master'
[master] Fix XSS in mermaid diagrams

See merge request gitlab/gitlabhq!2597
2018-11-28 19:09:28 -05:00

24 lines
519 B
Ruby

require 'spec_helper'
describe 'Mermaid rendering', :js do
it 'renders Mermaid diagrams correctly' do
description = <<~MERMAID
```mermaid
graph TD;
A-->B;
A-->C;
B-->D;
C-->D;
```
MERMAID
project = create(:project, :public)
issue = create(:issue, project: project, description: description)
visit project_issue_path(project, issue)
%w[A B C D].each do |label|
expect(page).to have_selector('svg text', text: label)
end
end
end