diff options
Diffstat (limited to 'spec/features/markdown')
-rw-r--r-- | spec/features/markdown/copy_as_gfm_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/markdown/mermaid_spec.rb | 4 | ||||
-rw-r--r-- | spec/features/markdown/sandboxed_mermaid_spec.rb | 32 |
3 files changed, 40 insertions, 0 deletions
diff --git a/spec/features/markdown/copy_as_gfm_spec.rb b/spec/features/markdown/copy_as_gfm_spec.rb index d3aaf339421..0e5a20fe24a 100644 --- a/spec/features/markdown/copy_as_gfm_spec.rb +++ b/spec/features/markdown/copy_as_gfm_spec.rb @@ -7,6 +7,10 @@ RSpec.describe 'Copy as GFM', :js do include RepoHelpers include ActionView::Helpers::JavaScriptHelper + before do + stub_feature_flags(refactor_blob_viewer: false) # This stub will be removed in https://gitlab.com/gitlab-org/gitlab/-/issues/350454 + end + describe 'Copying rendered GFM' do before do @feat = MarkdownFeature.new diff --git a/spec/features/markdown/mermaid_spec.rb b/spec/features/markdown/mermaid_spec.rb index e080c7ffb3f..6a91d4e03c1 100644 --- a/spec/features/markdown/mermaid_spec.rb +++ b/spec/features/markdown/mermaid_spec.rb @@ -5,6 +5,10 @@ require 'spec_helper' RSpec.describe 'Mermaid rendering', :js do let_it_be(:project) { create(:project, :public) } + before do + stub_feature_flags(sandboxed_mermaid: false) + end + it 'renders Mermaid diagrams correctly' do description = <<~MERMAID ```mermaid diff --git a/spec/features/markdown/sandboxed_mermaid_spec.rb b/spec/features/markdown/sandboxed_mermaid_spec.rb new file mode 100644 index 00000000000..f118fb3db66 --- /dev/null +++ b/spec/features/markdown/sandboxed_mermaid_spec.rb @@ -0,0 +1,32 @@ +# 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 + + expected = %(<iframe src="/-/sandbox/mermaid" sandbox="allow-scripts" frameborder="0" scrolling="no") + expect(page.html).to include(expected) + end +end |