diff options
Diffstat (limited to 'spec/lib/banzai/filter/math_filter_spec.rb')
-rw-r--r-- | spec/lib/banzai/filter/math_filter_spec.rb | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/spec/lib/banzai/filter/math_filter_spec.rb b/spec/lib/banzai/filter/math_filter_spec.rb index dd116eb1109..c5d2bcd5363 100644 --- a/spec/lib/banzai/filter/math_filter_spec.rb +++ b/spec/lib/banzai/filter/math_filter_spec.rb @@ -97,7 +97,8 @@ RSpec.describe Banzai::Filter::MathFilter do describe 'block display math using $$\n...\n$$ syntax' do context 'with valid syntax' do where(:text, :result_template) do - "$$\n2+2\n$$" | "<math>2+2</math>" + "$$\n2+2\n$$" | "<math>2+2</math>" + "$$\n2+2\n3+4\n$$" | "<math>2+2\n3+4</math>" end with_them do @@ -110,35 +111,35 @@ RSpec.describe Banzai::Filter::MathFilter do describe 'display math using ```math...``` syntax' do it 'adds data-math-style display attribute to display math' do - doc = filter('<pre class="code highlight js-syntax-highlight language-math" v-pre="true"><code>2+2</code></pre>') + doc = filter('<pre lang="math"><code>2+2</code></pre>') pre = doc.xpath('descendant-or-self::pre').first expect(pre['data-math-style']).to eq 'display' end it 'adds js-render-math class to display math' do - doc = filter('<pre class="code highlight js-syntax-highlight language-math" v-pre="true"><code>2+2</code></pre>') + doc = filter('<pre lang="math"><code>2+2</code></pre>') pre = doc.xpath('descendant-or-self::pre').first expect(pre[:class]).to include("js-render-math") end it 'ignores code blocks that are not math' do - input = '<pre class="code highlight js-syntax-highlight language-plaintext" v-pre="true"><code>2+2</code></pre>' + input = '<pre lang="plaintext"><code>2+2</code></pre>' doc = filter(input) expect(doc.to_s).to eq input end it 'requires the pre to contain both code and math' do - input = '<pre class="highlight js-syntax-highlight language-plaintext language-math" v-pre="true"><code>2+2</code></pre>' + input = '<pre lang="math">something</pre>' doc = filter(input) expect(doc.to_s).to eq input end it 'dollar signs around to display math' do - doc = filter('$<pre class="code highlight js-syntax-highlight language-math" v-pre="true"><code>2+2</code></pre>$') + doc = filter('$<pre lang="math"><code>2+2</code></pre>$') before = doc.xpath('descendant-or-self::text()[1]').first after = doc.xpath('descendant-or-self::text()[3]').first |