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

gitlab.com/gitlab-org/gitlab-foss.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-08-19 12:08:42 +0300
commitb76ae638462ab0f673e5915986070518dd3f9ad3 (patch)
treebdab0533383b52873be0ec0eb4d3c66598ff8b91 /spec/lib/banzai/filter/table_of_contents_tag_filter_spec.rb
parent434373eabe7b4be9593d18a585fb763f1e5f1a6f (diff)
Add latest changes from gitlab-org/gitlab@14-2-stable-eev14.2.0-rc42
Diffstat (limited to 'spec/lib/banzai/filter/table_of_contents_tag_filter_spec.rb')
-rw-r--r--spec/lib/banzai/filter/table_of_contents_tag_filter_spec.rb38
1 files changed, 31 insertions, 7 deletions
diff --git a/spec/lib/banzai/filter/table_of_contents_tag_filter_spec.rb b/spec/lib/banzai/filter/table_of_contents_tag_filter_spec.rb
index 56f36af5066..082e5c92e53 100644
--- a/spec/lib/banzai/filter/table_of_contents_tag_filter_spec.rb
+++ b/spec/lib/banzai/filter/table_of_contents_tag_filter_spec.rb
@@ -6,18 +6,42 @@ RSpec.describe Banzai::Filter::TableOfContentsTagFilter do
include FilterSpecHelper
context 'table of contents' do
- let(:html) { '<p>[[<em>TOC</em>]]</p>' }
+ shared_examples 'table of contents tag' do
+ it 'replaces toc tag with ToC result' do
+ doc = filter(html, {}, { toc: "FOO" })
- it 'replaces [[<em>TOC</em>]] with ToC result' do
- doc = filter(html, {}, { toc: "FOO" })
+ expect(doc.to_html).to eq("FOO")
+ end
- expect(doc.to_html).to eq("FOO")
+ it 'handles an empty ToC result' do
+ doc = filter(html)
+
+ expect(doc.to_html).to eq ''
+ end
+ end
+
+ context '[[_TOC_]] as tag' do
+ it_behaves_like 'table of contents tag' do
+ let(:html) { '<p>[[<em>TOC</em>]]</p>' }
+ end
end
- it 'handles an empty ToC result' do
- doc = filter(html)
+ context '[[_toc_]] as tag' do
+ it_behaves_like 'table of contents tag' do
+ let(:html) { '<p>[[<em>toc</em>]]</p>' }
+ end
+ end
+
+ context '[TOC] as tag' do
+ it_behaves_like 'table of contents tag' do
+ let(:html) { '<p>[TOC]</p>' }
+ end
+ end
- expect(doc.to_html).to eq ''
+ context '[toc] as tag' do
+ it_behaves_like 'table of contents tag' do
+ let(:html) { '<p>[toc]</p>' }
+ end
end
end
end