2022-03-02 08:16:31 +05:30
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
require 'spec_helper'
|
|
|
|
|
|
|
|
RSpec.describe 'Sandboxed Mermaid rendering', :js do
|
|
|
|
let_it_be(:project) { create(:project, :public) }
|
|
|
|
|
|
|
|
before do
|
|
|
|
stub_feature_flags(sandboxed_mermaid: true)
|
|
|
|
end
|
|
|
|
|
|
|
|
it 'includes mermaid frame correctly' do
|
|
|
|
description = <<~MERMAID
|
|
|
|
```mermaid
|
|
|
|
graph TD;
|
|
|
|
A-->B;
|
|
|
|
A-->C;
|
|
|
|
B-->D;
|
|
|
|
C-->D;
|
|
|
|
```
|
|
|
|
MERMAID
|
|
|
|
|
|
|
|
issue = create(:issue, project: project, description: description)
|
|
|
|
|
|
|
|
visit project_issue_path(project, issue)
|
|
|
|
|
|
|
|
wait_for_requests
|
|
|
|
|
2022-05-07 20:08:51 +05:30
|
|
|
expected = %(<iframe src="/-/sandbox/mermaid" sandbox="allow-scripts allow-popups" frameborder="0" scrolling="no")
|
2022-03-02 08:16:31 +05:30
|
|
|
expect(page.html).to include(expected)
|
|
|
|
end
|
|
|
|
end
|