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

table_of_contents_tag_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: 56f36af5066c55f3e0963ff229e55178bcef853b (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::TableOfContentsTagFilter do
  include FilterSpecHelper

  context 'table of contents' do
    let(:html) { '<p>[[<em>TOC</em>]]</p>' }

    it 'replaces [[<em>TOC</em>]] with ToC result' do
      doc = filter(html, {}, { toc: "FOO" })

      expect(doc.to_html).to eq("FOO")
    end

    it 'handles an empty ToC result' do
      doc = filter(html)

      expect(doc.to_html).to eq ''
    end
  end
end