diff options
Diffstat (limited to 'spec/lib/banzai')
-rw-r--r-- | spec/lib/banzai/filter/mermaid_filter_spec.rb | 12 | ||||
-rw-r--r-- | spec/lib/banzai/filter/syntax_highlight_filter_spec.rb | 2 |
2 files changed, 13 insertions, 1 deletions
diff --git a/spec/lib/banzai/filter/mermaid_filter_spec.rb b/spec/lib/banzai/filter/mermaid_filter_spec.rb new file mode 100644 index 00000000000..532d25e121d --- /dev/null +++ b/spec/lib/banzai/filter/mermaid_filter_spec.rb @@ -0,0 +1,12 @@ +require 'spec_helper' + +describe Banzai::Filter::MermaidFilter do + include FilterSpecHelper + + it 'adds `js-render-mermaid` class to the `pre` tag' do + doc = filter("<pre class='code highlight js-syntax-highlight mermaid' lang='mermaid' v-pre='true'><code>graph TD;\n A-->B;\n</code></pre>") + result = doc.xpath('descendant-or-self::pre').first + + expect(result[:class]).to include('js-render-mermaid') + end +end diff --git a/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb b/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb index 5a23e0e70cc..9f2efa05a01 100644 --- a/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb +++ b/spec/lib/banzai/filter/syntax_highlight_filter_spec.rb @@ -31,7 +31,7 @@ describe Banzai::Filter::SyntaxHighlightFilter do it "highlights as plaintext" do result = filter('<pre><code lang="ruby">This is a test</code></pre>') - expect(result.to_html).to eq('<pre class="code highlight" lang="" v-pre="true"><code>This is a test</code></pre>') + expect(result.to_html).to eq('<pre class="code highlight js-syntax-highlight" lang="" v-pre="true"><code>This is a test</code></pre>') end end end |