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

ascii_doc_post_processing_filter_spec.rb « filter « banzai « lib « spec - gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 3bd48bdd6f79b6ca87f5b65cc0edfc1f851c803e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
# frozen_string_literal: true

require 'spec_helper'

RSpec.describe Banzai::Filter::AsciiDocPostProcessingFilter, feature_category: :wiki do
  include FilterSpecHelper

  it "adds class for elements with data-math-style" do
    result = filter('<pre data-math-style="inline">some code</pre><div data-math>and</div>').to_html
    expect(result).to eq('<pre data-math-style="inline" class="code math js-render-math">some code</pre><div data-math>and</div>')
  end

  it "adds class for elements with data-mermaid-style" do
    result = filter('<pre data-mermaid-style="display">some code</pre>').to_html

    expect(result).to eq('<pre data-mermaid-style="display" class="js-render-mermaid">some code</pre>')
  end

  it "keeps content when no data-math-style found" do
    result = filter('<pre>some code</pre><div data-math>and</div>').to_html
    expect(result).to eq('<pre>some code</pre><div data-math>and</div>')
  end
end