diff options
author | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 09:08:56 +0000 |
---|---|---|
committer | GitLab Bot <gitlab-bot@gitlab.com> | 2020-02-10 09:08:56 +0000 |
commit | b4ded0ba7b4d2cdbed5b1f331cf2083a25ee4d7c (patch) | |
tree | 6694fa9d8f3e226597cc01dfb8e3e07b50ae85b6 /spec/lib/banzai/pipeline | |
parent | 2aaef94c80937d9d188f7b9cbbad2dcd1508c3c1 (diff) | |
download | gitlab-ce-b4ded0ba7b4d2cdbed5b1f331cf2083a25ee4d7c.tar.gz |
Add latest changes from gitlab-org/gitlab@master
Diffstat (limited to 'spec/lib/banzai/pipeline')
-rw-r--r-- | spec/lib/banzai/pipeline/full_pipeline_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/lib/banzai/pipeline/full_pipeline_spec.rb b/spec/lib/banzai/pipeline/full_pipeline_spec.rb index f63b86d1451..4fa39da3eb4 100644 --- a/spec/lib/banzai/pipeline/full_pipeline_spec.rb +++ b/spec/lib/banzai/pipeline/full_pipeline_spec.rb @@ -99,4 +99,35 @@ describe Banzai::Pipeline::FullPipeline do end end end + + describe 'table of contents' do + let(:project) { create(:project, :public) } + let(:markdown) do + <<-MARKDOWN.strip_heredoc + [[_TOC_]] + + # Header + MARKDOWN + end + let(:invalid_markdown) do + <<-MARKDOWN.strip_heredoc + test [[_TOC_]] + + # Header + MARKDOWN + end + + it 'inserts a table of contents' do + output = described_class.to_html(markdown, project: project) + + expect(output).to include("<ul class=\"section-nav\">") + expect(output).to include("<li><a href=\"#header\">Header</a></li>") + end + + it 'does not insert a table of contents' do + output = described_class.to_html(invalid_markdown, project: project) + + expect(output).to include("test [[<em>TOC</em>]]") + end + end end |