Welcome to mirror list, hosted at ThFree Co, Russian Federation.

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2022-11-01 21:10:46 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2022-11-01 21:10:46 +0300
commit28d82e1650f73793f752425db2e1f26722b20b41 (patch)
treeef1d9902191ea305120c4608d489c97b87a337a3 /spec/features/markdown
parenteac94e5cd6a59aad41ff1f86ed7cc892898d8516 (diff)
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/features/markdown')
-rw-r--r--spec/features/markdown/sandboxed_mermaid_spec.rb60
1 files changed, 44 insertions, 16 deletions
diff --git a/spec/features/markdown/sandboxed_mermaid_spec.rb b/spec/features/markdown/sandboxed_mermaid_spec.rb
index 056a6b86f46..2bf88d7882d 100644
--- a/spec/features/markdown/sandboxed_mermaid_spec.rb
+++ b/spec/features/markdown/sandboxed_mermaid_spec.rb
@@ -3,26 +3,54 @@
require 'spec_helper'
RSpec.describe 'Sandboxed Mermaid rendering', :js do
- let_it_be(:project) { create(:project, :public) }
-
- it 'includes mermaid frame correctly' do
- description = <<~MERMAID
- ```mermaid
- graph TD;
- A-->B;
- A-->C;
- B-->D;
- C-->D;
- ```
+ let_it_be(:project) { create(:project, :public, :repository) }
+ let_it_be(:description) do
+ <<~MERMAID
+ ```mermaid
+ graph TD;
+ A-->B;
+ A-->C;
+ B-->D;
+ C-->D;
+ ```
MERMAID
+ end
+
+ let_it_be(:expected) do
+ %(<iframe src="/-/sandbox/mermaid" sandbox="allow-scripts allow-popups" frameborder="0" scrolling="no")
+ end
+
+ context 'in an issue' do
+ let(:issue) { create(:issue, project: project, description: description) }
+
+ it 'includes mermaid frame correctly' do
+ visit project_issue_path(project, issue)
+
+ wait_for_requests
+
+ expect(page.html).to include(expected)
+ end
+ end
+
+ context 'in a merge request' do
+ let(:merge_request) { create(:merge_request_with_diffs, source_project: project, description: description) }
+
+ it 'renders diffs and includes mermaid frame correctly' do
+ visit(diffs_project_merge_request_path(project, merge_request))
+
+ wait_for_requests
- issue = create(:issue, project: project, description: description)
+ page.within('.tab-content') do
+ expect(page).to have_selector('.diffs')
+ end
- visit project_issue_path(project, issue)
+ visit(project_merge_request_path(project, merge_request))
- wait_for_requests
+ wait_for_requests
- expected = %(<iframe src="/-/sandbox/mermaid" sandbox="allow-scripts allow-popups" frameborder="0" scrolling="no")
- expect(page.html).to include(expected)
+ page.within('.merge-request') do
+ expect(page.html).to include(expected)
+ end
+ end
end
end