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-04-20 17:36:54 +0300
committerGitLab Bot <gitlab-bot@gitlab.com>2021-04-20 17:36:54 +0300
commitf61bb2a16a514b71bf33aabbbb999d6732016a24 (patch)
tree9548caa89e60b4f40b99bbd1dac030420b812aa8 /spec/lib/banzai/pipeline/wiki_pipeline_spec.rb
parent35fc54e5d261f8898e390aea7c2f5ec5fdf0539d (diff)
Add latest changes from gitlab-org/gitlab@13-11-stable-eev13.11.0-rc42
Diffstat (limited to 'spec/lib/banzai/pipeline/wiki_pipeline_spec.rb')
-rw-r--r--spec/lib/banzai/pipeline/wiki_pipeline_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb b/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb
index b102de24041..007d310247b 100644
--- a/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb
+++ b/spec/lib/banzai/pipeline/wiki_pipeline_spec.rb
@@ -289,4 +289,29 @@ RSpec.describe Banzai::Pipeline::WikiPipeline do
expect(output).to include('<audio src="/wiki_link_ns/wiki_link_project/-/wikis/nested/twice/audio%20file%20name.wav"')
end
end
+
+ describe 'gollum tag filters' do
+ context 'when local image file exists' do
+ it 'sets the proper attributes for the image' do
+ gollum_file_double = double('Gollum::File',
+ mime_type: 'image/jpeg',
+ name: 'images/image.jpg',
+ path: 'images/image.jpg',
+ data: '')
+
+ wiki_file = Gitlab::Git::WikiFile.new(gollum_file_double)
+ markdown = "[[#{wiki_file.path}]]"
+
+ expect(wiki).to receive(:find_file).with(wiki_file.path, load_content: false).and_return(wiki_file)
+
+ output = described_class.to_html(markdown, project: project, wiki: wiki, page_slug: page.slug)
+ doc = Nokogiri::HTML::DocumentFragment.parse(output)
+
+ full_path = "/wiki_link_ns/wiki_link_project/-/wikis/nested/twice/#{wiki_file.path}"
+ expect(doc.css('a')[0].attr('href')).to eq(full_path)
+ expect(doc.css('img')[0].attr('class')).to eq('gfm lazy')
+ expect(doc.css('img')[0].attr('data-src')).to eq(full_path)
+ end
+ end
+ end
end